Instead of playing with fire by having their possession in their half, giving Portugal free counters (the freekick ronaldo scored was not the only time they approached the goal in the last minutes) they should had gotten a quick player in the last minutes to play behind Portugal's fullbacks that would need to push forward (like the whole team) to desperately score. Then depending on the situation go for goal or win a corner / draw a foul. And yes, even in the 80-something. You have to kill the game, you do it like that, only a "green" team fucks around like spain did.