Portugal's Cristiano Ronaldo, left, celebrates with his teammate Diogo Jota after he scored his side's second goal during their Euro 2020 group B qualifying match against Luxembourg at the Josy Barthel Stadium in Luxembourg on Sunday. Photo: Francisco Seco/AP

LUXEMBOURG - Defending champions Portugal edged past Luxembourg 2-0 away from home on Sunday to qualify for Euro 2020.

Bruno Fernandes broke the deadlock in the 39th minute and Cristiano Ronaldo added the second with four minutes left to ensure that Portugal finished second in Group B with 17 points, three ahead of Serbia who drew 2-2 with Ukraine.

Ronaldo's goal took his international tally to 99, leaving him on the brink of becoming only the second player in history to score 100 goals for a national team. 

In the day's other game, a stoppage time equaliser by late substitute Artem Besyedin gave Ukraine a 2-2 draw in Serbia after the home side led twice in an entertaining Euro 2020 Group B qualifier.

The Ukrainians, who had already secured a berth in next year's 24-nation tournament, finished their campaign top of the group on 20 points from eight games.

European champions Portugal (17 points) joined them after a laboured 2-0 win at Luxembourg while third-placed Serbia, who collected 14 points, will have another chance to advance via the Nations League playoffs in March.

A mere 4,000 fans turned up at Rajko Mitic stadium although Serbia started the game with an outside chance of qualifying and the home side treated their supporters to a solid performance.

Dusan Tadic fired Serbia ahead with a ninth-minute penalty as he sent goalkeeper Andriy Pyatov the wrong way after Mykola Matviyenko handled the winger's shot from the edge of the area.

Andriy Yarmolenko hit the post for Ukraine before Roman Yaremchuk levelled in the 32nd minute, heading home from close range after a Viktor Tsygankov cross from the right.

Fulham striker Aleksandar Mitrovic restored Serbia's lead in the 56th with a fine finish, as he chested down an inch-perfect Tadic cross and steered the ball into the opposite corner with the outside of his foot.

Ukraine laid siege to Serbia's goal in the closing stages and although home keeper Predrag Rajkovic kept out an Oleksandr Karavaev piledriver, Besyedin scored moments later when he swept a low shot from 10 metres into the bottom corner.