DORTMUND, Germany — Bundesliga champion Borussia Dortmund held on for a 2-1 Champions League win over Real Madrid to ensure the Spanish champions' miserable record in Germany was extended on Wednesday.

Marcel Schmelzer's 64th-minute strike proved to be the winner for the Bundesliga champions. Cristiano Ronaldo had pulled Madrid level two minutes after Robert Lewandowski opened the scoring in the 36th.

It was Dortmund's first win at home over a Spanish opponent at the sixth attempt, while Madrid has now lost 17 of its 24 games in Germany against a German opponent. Madrid's only win was a 3-2 win at Bayer Leverkusen in 2000.

Dortmund tops Group D with seven points after three games. Ajax beat Manchester City 3-1 in the other group game.

Schalke 2, Arsenal 0

LONDON — Netherlands internationals Klaas-Jan Huntelaar and Ibrahim Afellay scored late goals as Schalke outclassed Arsenal, lifting the team above the English side to the top of Group B.

The German visitors had wasted a string of good openings by the time Huntelaar put them in front with a low drive in the 76th minute, his ninth goal of the season for club and country.

Afellay clinched victory for Schalke in the 86th, slotting home from close range after Jefferson Farfan had evaded Arsenal's defence again down the right.

The loss ended Arsenal's perfect start to the competition and leaves manager Arsene Wenger with some worrying problems after being outclassed in every department.

Schalke is on seven points — one ahead of Arsenal.

Ajax 3, Manchester City 1

AMSTERDAM, Netherlands — Ajax stunned Manchester City through goals from Siem de Jong, Niklas Moisander and man of the match Christian Eriksen.

Ajax put the visitors under pressure from the start, but City scored on a counter attack in the 22nd minute when Samir Nasri was left unmarked and slotted home easily. But De Jong equalized just before halftime, volleying a cross past England international Joe Hart in the City goal.

Moisander rose perfectly to meet a corner by Eriksen in the 57th to give the home side its first lead. Eriksen then evaded several defenders to score in the 68th, when his shot deflected off Gael Clichy.

The result sees Ajax leapfrog City into third place in Group D with three points from three games while City remains on 1 point.

Malaga 1, AC Milan 0

MALAGA, Spain — Joaquin Sanchez made up for a penalty miss by scoring the lone goal in the match in the second half as Malaga continued its unbeaten start in the Champions League.

Joaquin curled a penalty off the crossbar in the 45th minute but made no mistake in the 64th when volleying Manuel Iturra's lob pass off the bounce and past goalkeeper Marco Amelia from a tight angle.

Malaga's third straight victory in Group C lifted it to nine points and further compounded Milan's miserable season. The Italian club has just four points and is 15th in Serie A — 15 points behind champion and leader Juventus.

Porto 3, Dynamo Kyiv 2

PORTO, Portugal — Jackson Martinez scored in each half in the Portuguese club's third straight win in the Champions League.

Martinez tapped in a low cross from Lucho Gonzalez in the 78th for victory after the visitors had twice equalized to get back in the game.

Porto stayed top of Group A after victories over Dinamo Zagreb and Paris Saint-Germain. Kyiv has one win and two losses.

Silvestre Varela put Porto ahead with a 15th-minute volley before Oleh Gusev headed in a corner five minutes later.

Martinez scored his first goal of the competition in the 36th, but Ideye Brown equalized in the 72nd after controlling a chip from Andriy Yarmolenko with his chest and volleying in from close range.

PSG 2, Dinamo Zagreb 0

ZAGREB, Croatia — Zlatan Ibrahimovic and Jeremy Menez of Paris Saint-Germain helped inflict a ninth successive loss in the Champions League for the Croatian team.

Ibrahimovic missed two chances before scoring in the 33rd minute after receiving a pass from Menez. The French winger scored in 43rd after a solo move that he ended by slotting the ball between the legs of Dinamo goalkeeper Ivan Kelava.

"Yet again we lost 2-0. Today, we had some chances but we made some stupid mistakes and conceded two goals," Dinamo Zagreb defender Domagoj Vida said. "PSG showed its class and used its opportunities."

PSG is second in Group A with six points, three behind FC Porto and three in front of Dynamo Kyiv, which lost 3-2 at Porto in the other match on Wednesday.

Ibrahimovic had another great chance in the 64th minute after Javier Pastore had dribbled through the defence, but the Sweden striker's lob narrowly missed the target.

A header by PSG substitute Guillaume Hoarau in the second minute of the injury time almost extended the lead.

Dinamo Zagreb's performance was a marked improvement on its previous matches against Porto and Dynamo Kyiv.

Olympiakos 2, Montpellier 2

MONTPELLIER, France — Greece striker Kostas Mitroglou scored in injury time as Olympiakos came from behind to beat struggling French champion Montpellier.

Gaetan Charbonnier's first Champions League goal was not enough for the hosts, with Greece defender Vassilis Torosidis equalizing in the 73rd with his team's first shot on target. Mitroglou then pounced one minute into stoppage time for victory.

Olympiakos now has three points to keep alive its hopes of qualifying from Group B. Montpellier, which is only a point above the relegation zone in the French league, is last with one point in the group.

Zenit St. Petersbrug 1, Anderlecht 0

ST. PETERSBURG, Russia — Alexander Kerzhakov scored a second-half penalty as Zenit St. Petersburg recorded its first win in the Champions League this season by beating Anderlecht 1-0 on Wednesday.

The home side was awarded a penalty when Marcin Wasilewski brought down Alexander Anyukov in the box. Kerzhakov beat Silvio Proto into the right corner for his 200th career goal.

The result lifted the Russian champion to third place in Group C. Anderlecht is last with one point from three games.

The two teams will meet again in two weeks.