Cristiano Ronaldo etched his name further into history on Tuesday night, equalling the all-time World Cup qualifying goals record as Portugal defeated Hungary 3-2 in Budapest.

The 40-year-old striker converted a penalty in the 58th minute to net his 39th World Cup qualifying goal, drawing level with Guatemala legend Carlos Ruiz. He now sits three clear of long-time rival Lionel Messi (36).

Ronaldo also extended his astonishing international tally to 141 goals in 223 appearances, the highest by any male footballer in history.

The five-time Ballon d’Or winner’s strike came after Barnabás Varga had given Hungary a 21st-minute lead, which was cancelled out by Bernardo Silva’s equaliser on the half-hour mark.

The match looked set to finish level after Varga struck again in the 84th minute, but Portugal found a late winner as João Cancelo rifled home two minutes later to secure a dramatic victory for Roberto Martínez’s side.

The result leaves Portugal top of Group F with maximum points after two matches, following their 5-0 thrashing of Armenia on Saturday in which Ronaldo netted twice.

Hungary sit third with one point, alongside the Republic of Ireland, who fell to a surprise 2-1 defeat to Armenia.