Whether it was a valid decision or not ( in terms of FIFA rules) depends entirely on what thought entered the linesman's head the instance the ball was kicked.
If he thought: "Crikey, that's close - looks like it could be offside to me. I'd better flag it" then he was wrong to raise his flag.
However, if he thought: "Ah, look...I can see Rodriguez' kneecap is closer to the goal line than any part of the defender's body - that's a nailed on offside" then it was a valid decision (regardless of whether the TV cameras prove he was right or wrong in retrospect)
Given we'll never know whether he put his flag up on a strong hunch (incorrect) or upon a clinical / photographic-esque observation (correct) we'll never know whether he was right or wrong to raise his flag.
Good result btw