Dortmund set a group-stage record with 21 goals as it stormed back from being 2-0 down.
Rome: Juventus and Borussia Dortmund finished up with the debatable advantage of being group winners, while Sevilla and FC Porto grabbed the final two spots in the last 16 of the Champions League on Wednesday.
Team that finishe top of their group will be drawn against a runner-up when the knockout stage begins – which usually offers a clear advantage.
Not this year.
With the likes of titleholder Real Madrid, Bayern Munich, Manchester City and Paris Saint-Germain hanging around as possible opponents in Monday's draw, group winners will be wary.
"When we reached the final in Berlin (in 2015) we had finished second in our group," Juventus CEO Giuseppe Marotta said. "When we finished first last season we were eliminated (by Bayern Munich).
"So it's difficult to think rationally. The important thing in the Champions League is the draw. We'll rely on destiny," Marotta said before a 2-0 win over Dinamo Zagreb made sure the Bianconeri would finish atop Group H.
Bayer Leverkusen finally scored from a penalty this season, although it needed help from the opposing goalkeeper, in a 3-0 victory over Monaco.
Both teams were already assured of advancing to the Round of 16 before the final group matches and Monaco fielded a youthful side missing many regulars. Monaco finished on 11 points, one more than Leverkusen, which for the first time ended a group stage undefeated.
Meanwhile, Tottenham won at Wembley Stadium at the third attempt, beating CSKA Moscow 3-1 to secure third place and a consolation spot in the Europa League.
Dele Alli and Harry Kane were on target as Tottenham won for only the second time in six games on its return to Europe's elite competition after a five-year absence.
A late equaliser by substitute Marco Reus earned Borussia Dortmund a 2-2 draw against defending champion Real Madrid and first place in the group.
Dortmund also set a group-stage record with 21 goals as it stormed back from being 2-0 down.
Karim Benzema had scored a goal in each half at the Santiago Bernabeu Stadium to give Madrid a convincing lead, but forward Pierre-Emerick Aubameyang pulled the German side closer in the 61st and Reus netted the decisive equalizer in the 88th.
Madrid were left with the consolation prize of matching the club's 34-game unbeaten streak that had stood since the late 1980s.
Dortmund finished the group with 14 points, two more than Madrid. Legia Warsaw, which defeated Sporting Lisbon 1-0 in Poland, finished third with four points to qualify for the Europa League.
Cristiano Ronaldo was held scoreless for the fourth straight time in the Champions League, again failing to become the first player to score 100 goals in European competitions. His current total is 98.
FC Porto breezed into the knockout phase with a 5-0 rout of Leicester, which had already secured top spot in the group on its competition debut.
Porto's emphatic victory over the much-changed English champions ensured they were not overtaken by FC Copenhagen, who beat Club Brugge 2-0 to finish with a Europa League place.
Yacine Brahimi scored twice, including a penalty, while Jesus Corona, Yacine Brahimi and Diogo Jota also netted.
Leicester finished two points ahead of Porto with 13 points from six games. In their Premier League title defense, Leicester have 13 points from 14 games to sit two points above the relegation zone.
Gonzalo Higuain ended his scoring drought as Juventus beat Dinamo Zagreb 2-0 to win the group.
Juventus already qualified for the knockout stages, but the victory secured top spot ahead of Sevilla, who also advanced following a 0-0 draw with Lyon.
Higuain blasted a strike into the top left corner from the edge of the area after being set up by Mario Lemina early in the second half.
It was Higuain's first goal since scoring on November 2 against Lyon.
Higuain joined Juventus before the season from rival Napoli for an Italian-record €90 million after scoring 36 Italian-league goals last season to break a 66-year-old Serie A record.
Defender Daniele Rugani added another for Juventus with a header from a corner taken by Miralem Pjanic.
Juventus finished with 14 points, three ahead of Sevilla. Lyon has eight points and will play in the Europa League, while Dinamo lost all six matches.