Speaking as a soccer referee, happy trails. He was fortunate not to get a second yellow earlier immediately after his first yellow for the initial dissent. The point of the yellow (a "caution") is to put you on notice that you are on thin ice. You can't make that play (the one that got him sent off) when you are already on a caution. No controversy at all about the send off (red, for the second yellow).
And bigger picture, Argentina was getting away with a lot of BS in that game. They could have had many more yellows, and likely one or two more reds. They lost because they played a better team, and they played dirty to try to even the game out. Which, unfortunately, worked. That, and Spain not having particularly good aim with most of its chances.