Real Madrid, as expected, were the team forcing the issue in the early exchanges, but Dortmund grew as the half developed, and the German outfit made the breakthrough in the 30th minute of the contest.
Serhou Guirassy has been full of goals this season, but he turned provider on this occasion, with his wonderful pass finding Donyell Malen, who fired his effort into the corner to silence the home side's supporters at Bernabeu.
Dortmund then had a second in the 34th minute of the contest, with Jamie Bynoe-Gittens turning a cross from Malen into the back of the net to become the youngest Englishman to ever score against Real Madrid in the Champions League.
Jude Bellingham should have halved the deficit shortly after Dortmund's second, but he somehow headed into the arms of the away side's goalkeeper Gregor Kobel from close range, before Rodrygo and Bellingham took it in turns to fire against the woodwork during an incredible period of the match, with BVB entering the interval two goals ahead.
Real Madrid had a goal back on the hour, though, with Antonio Rudiger heading a brilliant Kylian Mbappe cross into the back of the net from close range, and it was then 2-2 in the 62nd minute, with Vinicius tapping into an empty net; the goal was initially chalked off for an offside on Mbappe, but it was given following a VAR check.
Los Blancos were the dominant outfit, with Dortmund struggling to defend what was now a point, and it did appear that there would only be one winner if there were to be more goals at Bernabeu.
That proved to be the case, with Lucas Vazquez smashing one into the far corner from a narrow angle, before Vinicius made it 4-2 with a wonderful solo goal; there was also still time for Vinicius to complete his hat trick, and it was another excellent strike from the forward, as he fired into the top of the net.
Vinicius is the huge favourite to secure the 2024 Ballon d'Or later this month, and there is no question that the Brazil international is one of the best footballers on the planet.
The result has seen Real Madrid move into ninth position in the Champions League table, boasting six points from three matches, while Dortmund sit up in fifth despite the setback.
REAL MADRID VS. BORUSSIA DORTMUND HIGHLIGHTS
Donyell Malen goal vs. Real Madrid (30th min, Real Madrid 0-1 Borussia Dortmund)
Dortmund take a shock lead in the 30th minute of the contest, as Guirassy expertly finds Malen inside the box, and the Dutchman strikes his effort into the corner - wonderful opening goal from the German giants.
Jamie Bynoe-Gittens goal vs. Real Madrid (34th min, Real Madrid 0-2 Borussia Dortmund)
BVB have their second of the match, as Bynoe-Gittens turns a low Malen cross into the back of the net; Vazquez was not alert at the far post, and the 20-year-old was on hand to tap into the corner to make it 2-0 to the visitors.
Rodrygo, Jude Bellingham hit the woodwork vs. Borussia Dortmund
Real Madrid come close to scoring on two separate occasions, but Rodrygo hits the post before Bellingham's effort strikes the crossbar and somehow does not drop over the line. Incredible scenes at Bernabeu!
Antonio Rudiger goal vs. Borussia Dortmund (60th min, Real Madrid 1-2 Borussia Dortmund)
Real Madrid get themselves back in the contest, as Rudiger heads a brilliant cross from Mbappe into the back of the net; Dortmund have been made to pay for retreating early in the second period in Madrid.
Vinicius Junior goal vs. Borussia Dortmund (62nd min, Real Madrid 2-2 Borussia Dortmund)
Real Madrid make it 2-2, with Vinicius tapping into the back of the net from inside the box. The goal was initially chalked off for an offside, but it counted following a check, with Mbappe shown to be onside.
Lucas Vazquez goal vs. Borussia Dortmund (83rd min, Real Madrid 3-2 Borussia Dortmund)
The comeback is complete - Real Madrid score a third at Bernabeu and surely win it, with Vazquez firing into the back of the net after breaking into the Dortmund box. It is a super finish from the stand-in captain!
Vinicius Junior goal vs. Borussia Dortmund (86th min, Real Madrid 4-2 Borussia Dortmund)
The win is secure; Real Madrid have their fourth of the match, and it is a stunning Vinicius goal. The Brazilian strides clear of Emre Can in a wide area before breaking into a shooting position and firing into the bottom corner. Wow!
Vinicius Junior goal vs. Borussia Dortmund (93rd min, Real Madrid 5-2 Borussia Dortmund)
Vinicius has his third! Real Madrid make it 5-2 on home soil, as their Brazilian superstar breaks through on goal before smashing the ball into the back of the net. What an incredible second half from the forward!
MAN OF THE MATCH - VINICIUS JUNIOR
Vinicius, like a number of his Real Madrid teammates, found it difficult in the first half of action, but the Brazilian was simply sensational in the second period, demonstrating why he is the favourite to win the Ballon d'Or.
The forward's first goal was a simple finish, but his last two were wonderful solo efforts, and Dortmund were simply unable to deal with the 24-year-old when he started to find his rhythm in Madrid.
REAL MADRID VS. BORUSSIA DORTMUND MATCH STATS
Possession: Real Madrid 52%-48% Borussia Dortmund
Shots: Real Madrid 26-8 Borussia Dortmund
Shots on target: Real Madrid 10-7 Borussia Dortmund
Corners: Real Madrid 11-4 Borussia Dortmund
Fouls: Real Madrid 10-11 Borussia Dortmund
BEST STATS
WHAT NEXT?
Real Madrid's attention will now switch back to La Liga and the small matter of a home game against Barcelona on Saturday night; Los Blancos are currently second in the La Liga table, three points behind the leaders Barcelona.
Dortmund, meanwhile, will resume their Bundesliga campaign against Augsburg on Saturday afternoon; a total of 13 points from their opening seven matches of the season has left them in seventh position in the Bundesliga table.