Shortly after Aleksandar Kolarov's shot just missed for Serbia, the visitors broke the deadlock three minutes before halftime against the flow of play. William Carvahlo took advantage of a fumble by goalkeeper Marko Dmitrovic, who collided with a teammate when he tried to catch a cross. The dropped ball fell to Carvahlo to push into the open net.
Goncalo Guedes doubled the lead in the 58th when he skillfully cut back to his left foot to ditch his marker before firing past Dmitrovic. Nikola Milenkovic pulled one back for Serbia in the 68th when he headed in an extremely poorly defended corner kick.
But Ronaldo, who had come close to scoring twice, took a through ball from Bernardo Silva and slipped it past Dmitrovic with 10 minutes remaining. Aleksandar Mitrovic rifled in Serbia's second goal in the 85th, moments before Silva scored Portugal's last goal with the hosts leaving their defense exposed searching for an equalizer.
Nelson Semedo had to be taken off on a cart midway through the second half when the right back injured his leg when fouled by a Serbian defender. Portugal climbed to second in Group B with five points from three games.
Ukraine, which won at Lithuania 3-0, leads the group with 13 points after five games. Serbia, which was playing its first match under manager Ljubisa Tumbakovic, was left with four points, the same as Luxembourg. Lithuania has one point.
More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports