Arsenal lost 2-1 at Olympiakos, allowing Schalke to be No. 1 in Group B despite drawing 1-1 with Montpellier.

Malaga had already clinched Group C before drawing 2-2 with Anderlecht, and second-place AC Milan lost 1-0 at home to Zenit St. Petersburg.

Madrid and Milan shape as dangerous unseeded teams in a well-balanced knockout stage. Teams cannot be paired with anyone from their home country, or an opponent already faced in the groups.

"Come February we will likely have to play against a difficult team that came top of its table and probably thought it would get an easy rival," Madrid coach Jose Mourinho said.

Ajax and Zenit join Kiev and Olympiakos as the third-place teams entering the last 32 of the Europa League. That draw is also made Dec. 20.

Ronaldo finished an excellent attack in the 13th minute that was started by Luka Modric's strong tackle in his own half and long diagonal pass to send Karim Benzema clear of the Ajax offside trap.

The Portugal winger's goal-a-game ratio in the group stage takes him clear of Lionel Messi, Burak Yilmaz and Alan, who each have five goals but could all play on Wednesday.

Modric set up Jose Callejon for the first of his two goals in the 28th. Callejon added a header in the 88th from Alvaro Morata's cross.

In between, Kaka curled in a perfectly placed left-foot shot from 25 meters (yards) in the 49th to give Madrid a 3-0 lead.

Ajax scored in the 59th when Derk Boerrigter volleyed into an unguarded net after backup goalkeeper Antonio Adan had weakly punched the ball out of his penalty area.

Dortmund, which was drawn into the toughest pool as the lowest-ranked team, sealed its deserved group win against the underachieving English champions. Julian Schieber scored in the 57th, sliding between defenders to connect with Jakub Blaszczykowski's pass at the far post.

"I think we've earned some respect now," Dortmund coach Juergen Klopp said. "I didn't necessarily think that we would end the group with 14 points."

Man City exit with just three points, the worst return from an English team in any Champions League group.

Another big spender, PSG, is under pressure in the French league but justified some of the massive outlay by its Qatari owners with a tournament-best fifth win thanks to two offseason signings from Italian clubs.

Brazilian defender Thiago Silva, formerly of Milan, headed the Paris side ahead in the 29th, and ex-Napoli forward Ezequiel Lavezzi scored a fortunate goal when his shot slipped through goalkeeper Helton's grasp in the 61st. Jackson Martinez headed Porto level in the 33rd.

"It was a good performance from us and we needed it to get the quality, attitude and spirit of the team back," PSG coach Carlo Ancelotti said.

In Croatia, play was stopped early in the first half during a snowstorm. Colored pitch markings were painted during the delay and play restarted with an orange ball.

Andriy Yarmolenko gave Kiev a 45th-minute lead, but Zagreb leveled deep into second-half stoppage time when substitute Ivan Krstanovic scored from the penalty spot.

The draw ended Zagreb's run of 11 straight group-stage defeats, stretching back to September 2011.

Arsenal manager Arsene Wenger rested most of his regulars for the trip to Greece, yet his team led through Tomas Rosicky's crisp, first-time shot in the 38th.

However, the Gunners again showed defensive frailty when Giannis Maniatis pounced on misdirected chest control in the goalmouth by Aaron Ramsey in the 64th.

Substitute Kostas Mitroglou fired the winner from 22 meters (yards) in the 73rd, but Arsenal will have more than two months to regroup before its next Champions League test.

"We had a good first half, but I believe we dropped physically in the second half because many of the players didn't have the match experience at that level," Wenger said.

Schalke won the group despite being held 1-1 away to Montpellier. Benedikt Hoewedes' header in the 56th for the Germans was leveled within three minutes, as Emanuel Herrera followed up to score after his initial header had been saved.

Malaga led twice against Anderlecht through captain Duda's goals in the 45th and 61st minutes. The Belgians struck back through Milan Jovanovic in the 50th and Dieumerci Mbokani in the 89th.

Zenit captain Danny scored with his team's first clear chance in the 35th minute, leaving Milan to advance despite collecting just eight points.