Luis Diaz scored a sensational winner with virtually the last kick of the match as Colombia beat Peru 3-2 in Brasilia on Friday to finish third in the Copa America. The goal was the 24-year-old Porto forward's second of the match and came just 10 minutes after Gianluca Lapadula looked to have sent the game into a penalty shoot-out. It was a thrilling encounter that ebbed and flowed, with Yoshimar Yotun giving Peru a first half lead before Colombia captain Juan Cuadrado equalized early in the second period. "We're happy, it was important to finish by winning," said Cuadrado, whose side lost their semi-final on penalties to Lionel Messi's Argentina, who play Neymar's Brazil in Saturday's final. "I'm happy with how we reacted [to going behind] and how we went after the result." Colombia had the better start and piled on early pressure but Peru held firm despite the ball often pinging around in their box. And Peru even had the first clear chance on 28 minutes when Christian Cueva's clever pass found Lapadula, but under pressure from a defender he fired narrowly wide from just inside the box. Diaz had a chance for Colombia but fired straight at goalkeeper Pedro Gallese. On 40 minutes Sergio Pena left Colombia's centre back Oscar Murillo on the floor with a clever turn, rounded goalkeeper Camilo Vargas but blazed well over the bar from a tight angle. Peru got the lead they deserved just before the break as Cueva's precise pass and Lapadula's clever run took out four defenders to set up Yotun for an emphatic finish. Colombia were back level just four minutes after the break as Cuadrado fired a free-kick through a disintegrating wall and past Gallese at his near post. Alexander Callens had given away the free-kick on the edge of the box with a clumsy challenge and compounded his error by jumping away from his fellow members of the wall to create the gap that Cuadrado exploited. Colombia's tails were up and Cuadrado's cross picked out man-of-the-match Diaz whose acrobatic overhead kick was parried over by Gallese. The game opened up and the dangerous Lapadula cut inside a defender on the right before firing in a left-foot shot that clipped the bar as it went over. It was end to end stuff with the goalkeepers playing a role in launching long range attacks. Gallese picked out Cueva to run at goal only for a Wilmar Barrios bodycheck to stop him in his tracks. But then Vargas launched a long ball up field for Diaz to scamper away and beat Gallese with a rasping finish on 66 minutes. Lapadula looked to have sent the match to penalties eight minutes from time when he rose almost unopposed to head home a Raziel Garcia corner from six yards out. But Diaz had the last word with a stunning strike from 25 yards that Gallese could only get his fingertips to as it rifled into the top corner.