ISTANBUL — FC Porto finished the Champions League group phase with an unbeaten record after earning a 3-2 victory at Galatasaray on Tuesday.

Porto entered the match in Istanbul having already clinched first place in Group D, and will advance to the round-of-16 on a run of five consecutive victories.

The Portuguese leaders got goals from Felipe and Moussa Marega before halftime, with Sergio Oliveira adding another goal in the second half.

Even so, they needed Galatasaray forward Sofiane Feghouli to miss a penalty to secure the win that gave them 16 points from the group.

"We wanted to equal our best (group stage) performance and it's a huge source of pride to be part of that history," Oliveira said.

Galatasaray still secured a third-place finish and a Europa League berth after last-place Lokomotiv Moscow lost 1-0 at Schalke, which had already locked up second place and a spot in the knockout rounds.

After fending off the hosts' initial push, Porto went ahead in the 17th minute when centre back Felipe got away from his marker and jumped to powerfully head home a curling free kick by Alex Telles.

Porto doubled the advantage in the 42nd after Galatasaray defender Mariano tripped Hernani as he dribbled past him inside the area. Marega drilled the spot kick in as goalkeeper Fernando Muslera dove the wrong way for the striker's sixth goal in the Champions League this season.

The hosts were able to pull one back in first-half stoppage time when Felipe fouled Garry Rodrigues as he made a move on the left side of the box. That allowed Feghouli, the only other Galatasaray player to offer anything in attack, to step up and slot the penalty kick into the corner of Iker Casillas' net.

Seconds after halftime, substitute Henry Onyekuru missed a clear chance to equalize from a pass by Feghouli. Instead, Porto got its third goal in the 57th. Danilo recovered the ball inside Galatasaray's half, and sent it forward for Hernani to reach the end line before finding Sergio Oliveira to score from close range.

Galatasaray coach Fatih Terim could only grimace when Eren Derdiyok flubbed a shot from point-blank range, but Derdiyok was finally on target when he slid to tap in a cross by Rodrigues in the 65th.

Rodrigues gave his team a chance to pull even in the 67th when he earned a penalty, only for Feghouli to fire the spot kick off the crossbar.

"Usually I am not happy after defeats, but the performance I saw today gave us some positive signs," said Terim. "However, I am sad because the boys' effort merited at least a draw today."

___

More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports