Portugal kept their hopes alive of making the quarter-finals at Euro 2012 with a thrilling 3-2 victory over Denmark in Lviv. Silvestre Varela was the hero as he scored the winner three minutes from time after two goals from Nicklas Bendtner had cancelled out first-half strikes from Pepe and Helder Postiga.
It was an edge-of-the-seat finale as the game swung back and forth with ample chances for both sides as Cristiano Ronaldo had a particularly profligate game in front of goal.
Realistically needing a win to stand a chance of making the last eight, Portugal started on the front foot. While, having caused an upset against the Netherlands in their opening encounter, Denmark looked content to merely contain their opponents.
Denmark's hopes of holding firm at the back were not helped, though, when key defensive midfielder Niki Zimling was forced off with an injury after just 15 minutes to be replaced by Jakob Poulsen.
Despite looking the most likely to score, Portugal were still struggling to find the cohesion often associated with their best sides. The one area where Portugal were causing Denmark problems was crosses in the box. And it was two balls of the highest quality that produced the opener for Paulo Bento's side.
Miguel Veloso whipped in a dangerous free-kick from more than 45 yards out that went right onto the six-yard box, forcing Denmark to clear behind. And from the resulting corner, Joao Moutinho produced an equally effective ball that Pepe burst toward the near post to get ahead of his marker and power a fine header past Stephan Andersen.
Lacking a schemer behind the front man in the mold of Deco and Rui Costa from years past, Bento appeared to have given his players clear instructions to get the ball out to their two greatest attacking threats, Ronaldo and Nani, as early as possible.
While Ronaldo was getting more involved finding space drifting in from the left, Nani was causing the Danes ample problems down the right flank.
It was the Manchester United man who played a major role in putting Portugal two goals to the good in the 36th minute. Receiving the ball at the back post, instead of merely aiming a hopeful cross back across the box, Nani picked out Postiga's near-post run with a clever side foot pass that the under-fire striker turned into the roof of the net with a fine first-time finish.
Though not facing an opponent firing on all cylinders, Denmark looked devoid of ideas and a shadow of the side that attacked with such purpose against the Dutch.
Yet, out of nowhere, a fine ball from Jakob Poulsen split open the Portuguese defense and gave Morten Olsen's side a lifeline less than five minutes before the break. The substitute curled a brilliant ball into the corridor between goalkeeper and defense that found Michael Krohn-Dehli at the back post and, showing ample composure, he placed a smart header over Rui Patricio and back across goal for Bendtner to head home into the unguarded net.
The goal clearly gave the Danes a massive lift as they suddenly played with more impetus than the previous 40 minutes combined. Portugal hung on for half time but not before launching a counter that came close to restoring their two goal advantage. Another fine cross from Nani that this time Postiga just failed to connect with and Simon Kjaer was alert to prevent Ronaldo from sticking the ball into an empty net.
The pattern continued in the second-half as Denmark maintained control of possession with Portugal looking to break at pace in behind.
Nani, having a fine game, was the architect once more as he found Ronaldo bursting clear through on goal in the inside left channel. But, lacking his usual conviction, Ronaldo side-footed a tame shot that Andersen saved smartly down to his left.
Portugal's two wide men continued to cause all the problems for Portugal, but Ronaldo was having yet another off-day in a major tournament.
With 12 minutes to play, Nani played Ronaldo in once more with a square pass that left his former Manchester United teammate completely free in front of goal for a gilt-edge chance, but the man who has been so prolific for Real Madrid slid his shot several feet wide of the goal to the astonishment of all around.
And Denmark looked like they had made Ronaldo pay the ultimate price just two minutes later. The irony only increased in that it was Ronaldo that left Lars Jacobsen unchecked to produce a cross that Bendtner met with a fine downward header that went in off the post. With his fifth goal in four appearances against Portugal, the Arsenal striker appeared to be the scourge of Portugal once more.
But Portugal were not done yet. Fabio Coentrao managed to pull the ball back from the left and, after completely fluffing his first attempt on his left foot, Varela made no mistake on his right, blasting a ferocious effort past Andersen at his near post.
In an incredible second-half, there was to be one final dramatic moment as Denmark came close to another equalizer. The ball was eventually worked to Lasse Schone at the back post, but the substitute showed little composure as he sliced his shot high and wide.
At the end of a breathless 90 minutes both sides will have all to play for on the final day in what is looking like an increasingly hard group to call.