Atletico stormed out of the blocks after Costa opened the scoring inside 43 seconds before Joao Felix doubled the lead seven minutes later.
Angel Correa and another Costa goal made it 4-0 by the 28th minute, with the latter completing his hat-trick via the penalty spot on the stroke of half-time.
Atlético refused to ease off in the second half as Felix set up Costa to chip Keylor Navas and make it 6-0.
Nacho pulled one back for Real Madrid before Costa and Carvajal saw red after an altercation in the 65th minute.
Vitolo restored Atlético’s six-goal lead with a spectacular solo run and finish after 70 minutes, and late consolation goals from Karim Benzema (penalty) and Javi Hernández Carrera did little to disguise the superiority of Diego Simeone’s side.
The heavy derby defeat follows defeat to Bayern Munich and a win on penalties over Arsenal.