Chelsea substitute Ba bundled the ball home in the 87th minute to secure a 2-0 win in the quarter-final, second leg at Stamford Bridge that sent the London club through after a 3-3 aggregate draw.
Madrid lost their return leg in Dortmund 2-0 but went through 3-2 on aggregate against last season’s runners-up having dominated the first clash last week.
The 2012 champions Chelsea were trailing 3-1 after their first leg in Paris but clawed their way back into the tie with a first half-goal from substitute Andre Schuerrle, before hitting the crossbar twice in two minutes shortly after the restart.
The visitors were clinging on bravely, but were undone in the dying stages when Ba scrambled the ball home after a Cesar Azpilicueta shot deflected into his path in the area.
Dortmund ran a below-par Madrid close, with Marco Reus scoring twice in the first-half to give the German side hope of completing an astonishing comeback.
Real’s Angel Di Maria missed a penalty before Reus pounced on a defensive mistake in the 24th minute to slot home Dortmund’s opener before doubling the lead on the night in the 37th from close range after Robert Lewandowski hit the post.
Dortmund missed a great chance to level the tie in the second half when Armenian Henrikh Mkhitaryan rounded Madrid keeper Iker Casillas but only managed to hit the post.
Manchester United travel to European champions Bayern Munich and Barcelona visit La Liga rivals Atletico Madrid in the remaining quarter-final, second-leg matches on Wednesday, with both ties level at 1-1.
The draw for the semi-finals will take place on Friday.
(Writing by Toby Davis; editing by Ken Ferris)