Sevilla, led by former Los Blancos boss Julen Lopetegui, could have moved a point clear of Madrid at the top of the table with victory, and they got off to a fine start thanks to Rafa Mir's early header.
Karim Benzema pulled the host side level shortly after the half-hour mark, before Vinicius secured maximum points three minutes from full-time with a wonderful long-range drive.
The result moved Carlo Ancelotti's men four points clear of Atletico Madrid and Real Sociedad at the top of the table, with Sevilla a further point back in fourth.
Sevilla went ahead in the 12th minute when an unmarked Mir headed Marcos Acuna's corner past Thibaut Courtois from 12 yards.
The striker should have scored again just minutes later, but David Alaba cleared his initial effort off the line and Courtois got down well to block the follow-up.
Lucas Ocampos hit the crossbar from distance as Sevilla sought to consolidate their lead, but Madrid pulled level when Benzema slotted into an empty net after Yassine Bounou had spilled Eder Militao's long-range strike onto the post.
Marco Asensio whipped wide from 25 yards shortly before the hour mark, while Vinicius wastefully blazed over after a rapid counter-attack.
The Brazil international had the final say, though, cutting in from the left and fizzing a strike past Bounou from 22 yards to seal an important win.