Borussia Dortmund made sure of top spot in Group F after fighting back from 2-0 down against defending champions Real Madrid, leaving the Spanish giants with theoretically a tougher draw to make the quarter-finals.

Borussia Dortmund set a new Champions League scoring record in a 2-2 draw against Real Madrid on Wednesday while FC Porto and Sevilla claimed the two remaining last-16 spots.

Dortmund made sure of top spot in Group F after fighting back from 2-0 down against defending champions Madrid, leaving the Spanish giants with theoretically a tougher draw to make the quarter-finals.

Marco Reus was the star of the late show at the Santiago Bernabeu, hitting the equaliser two minutes from time.

A double from Karim Benzema looked to have Real well set to leapfrog the Germans and secure a home game in the second leg of their last-16 tie.

However, Pierre-Emerick Aubameyang reduced the arrears before substitute Reus slid in to turn Aubameyang's dangerous low cross high into the net.

Dortmund scored 21 goals in their group campaign, the most for any team in a group stage in the history of the tournament.

"Real had some big chances in the second half, but we hoped for a lucky punch and we got it," said Reus.

"'Auba' was world-class with his pass and I was happy to get on the end of it -- the goal was 99 percent him and one from me."

Real coach Zinedine Zidane said his team should have killed off the game.

"We gave the game away by missing chances to score the third goal," said Zidane.

Sevilla made the last 16 for the first time in seven years after soaking up the pressure to draw 0-0 away to Lyon.

Lyon -- who lost 1-0 in Seville in September and trailed the Spaniards by three points -- needed to win by two clear goals to go through.

But they could not find a way through, with Corentin Tolisso and Mathieu Valbuena both hitting the woodwork.

"I am satisfied because we have put in enormous efforts to qualify against very important opponents," said Sevilla coach Jorge Sampaoli.

Table-topping Juventus defeated Dinamo Zagreb 2-0 with Gonzalo Higuain and Daniele Rugani on target. The Croatians finished their campaign having failed to score a single goal.

- Leicester claim unwanted record -

Leicester City, who had already made sure of top spot in Group G in their debut season in the competition, suffered their first loss of the campaign, 5-0 at Porto who went through as runners-up.

Porto, the 1987 and 2004 European champions, opened the scoring after just six minutes when Andre Silva headed in a corner from Jesus Corona.

Corona hit a spectacular second goal with a left-footed volley from a cross by Yacine Brahimi after being left unmarked in the area. Brahimi made it 3-0 with a cheeky backheel before the interval.

Silva added a fourth from the penalty spot on 64 minutes after Danny Drinkwater had hauled down the striker in the penalty area with Diogo Jota making it 5-0, the biggest Champions League defeat for an English club.

"We can lose, but I want us to show our character and our strength. We didn't do that well enough tonight," said Leicester coach Claudio Ranieri.

FC Copenhagen had harboured hopes of pipping Porto for second place but despite a 2-0 win at pointless Club Brugge, they had to settle for a Europa League place.

In Group E, Bayer Leverkusen, already assured of second spot, downed Monaco 3-0 but the win wasn't enough to overhaul the table-topping French side.

Tottenham Hotspur, meanwhile, came back from a goal down to defeat CSKA Moscow 3-1 and claim a Europa League place.

Alan Dzagoev put the Russians ahead after 33 minutes, but the lead lasted just five minutes until Dele Alli levelled from a Christian Eriksen cross to ensure that CSKA goalkeeper Igor Akinfeev's miserable Champions League record of failing to keep a clean sheet stretched to 39 games.

Harry Kane and an Akinfeev own-goal gave Spurs the three points.

England star Kane admitted that Tottenham need to improve their home form if they are to progress in future European adventures.

"You are playing the best teams in Europe so you can't rely on away results which we have done this season," said Kane.