Cristiano Ronaldo scored twice as Portugal edged a 3-2 thriller against Slovakia in Porto on Friday to book their place at Euro 2024. 

Ronaldo scored a first-half penalty and a second half tap-in as the Portuguese made it seven wins from seven matches in Group J. They have 21 points which ensures them a top two finish. 

"Cristiano Ronaldo is having a great time, playing a lot of minutes and scoring a lot of goals for his club," said Portugal coach Roberto Martinez.

"He has a lot of experience with the national team and he's a reference point for young players."

Slovakia are eight points back in second, two ahead of Luxembourg who they play on Monday. 

Portugal got off to a flying start when Ramos rose highest to meet Bruno Fernandes' cross in the eighth minute, heading the ball down and past Martin Dubravka in the Slovakia goal. 

It marked a seventh goal in just nine matches for Ramos and a sixth assist of the campaign for Fernandes who almost doubled the score in the 26th minute only to be denied by a brilliant one-handed save by Dubravka.

Three minutes later Denis Vavro was adjudged to have handled the ball, a decision confirmed by VAR. 

Ronaldo stepped up to slot home his 124th goal for Portugal in the venue where he scored his first international goal, against Greece in the opening game of Euro 2004.

Slovakia came back into the game in the 69th minute when David Hancko's shot from outside the area deflected off Antonio Silva's heel and into the bottom corner - the first goal Portugal had conceded in qualifying.

Three minutes later, Ronaldo restored the two-goal advantage tapping in another lovely cross from Fernandes for goal number 125. 

Ten minutes from time, however, the game was back on as Stanislav Lobotka let fly from outside the area and buried the ball in the top corner. 

Portugal should have sealed it late on but Diogo Jota was denied by the outstanding Dubravka but the hosts had done enough to stamp their ticket for the Euros.   

"We won the match with a very good first half," said Martinez. 

"The important thing was the result. In seven games we've shown a perfect attitude. I'm very satisfied, but it's only a stage."