Luis Suarez's second-half strike consigned Barcelona's rivals Espanyol to a 1-0 defeat and relegation from LaLiga in a match that saw two red cards.
Espanyol knew anything but a derby victory at Camp Nou on Wednesday would relegate them to the second tier for the first time since 1994.
They were given hope when substitute Ansu Fati was sent off five minutes after coming on at the start of the second half, only for the numbers to be swiftly evened up when Pol Lozano was also dismissed.
Suarez capped off a crazy six-minute passage by scoring the only goal as Barca moved a point behind leaders Real Madrid, who have a game in hand, in the title race.
In an all-or-nothing game for Espanyol, they were the better side in the first half, while Barca failed to have a single shot on target.
Adrian Embarba was the first to test Marc-Andre ter Stegen when he got in down the right, only for the German goalkeeper to thwart his effort with an outstretched right foot.
Espanyol continued to have joy on the counter attack and after Ter Stegen prevented a Clement Lenglet own goal, Didac Vila's effort hit the outside of the post just before half-time.
Quique Setien hoped Fati's half-time introduction would have an impact on his team and it certainly did, though not how he had imagined.
Five minutes after coming on the teenager was heading off again, a VAR review upgrading his caution to a red card as he was punished when a high right foot caught Fernando Calero.
However, Espanyol's one-man advantage lasted only three minutes, as Lozano joined Fati in being dismissed.
As was the case in Fati's instance, Lozano was initially awarded a yellow card that was changed to a red as replays showed he caught Gerard Pique on the shin when going over the top of the ball.
And it was Barcelona who adjusted better to going a man down as Suarez soon put them ahead, following up when Lionel Messi's effort was blocked after a brilliant Antoine Griezmann flick.
A vicious Messi volley was superbly saved by Diego Lopez and Espanyol could not muster an equaliser, let alone the two goals they needed, as their fate was sealed.
What does it mean? Espanyol go down with a fight
Espanyol have looked doomed for months, but they at least showed plenty of fight, even if it was a case of too little, too late.
It might be too late for Barca in the title race too with just three games to play, though Setien will at least be encouraged by Griezmann, Messi and Suarez's role in their goal ahead of the Champions League resumption next month.
A lovely goal at Villarreal last time out suggested Griezmann may finally be finding his feet at Camp Nou, and he had an instrumental role in the winner here too.
Though he will not be credited with either a goal or an assist, his vision to initially tee up Messi was fantastic.
Fati deserves criticism for raising his foot way too high to prompt his red card, but Lozano had to be smarter when he was dismissed moments later in his first LaLiga start.
To rush into a challenge with Pique in midfield was ill-judged and Espanyol barely had any opportunity to make use of their one-man advantage as a result.
Barcelona travel to Real Valladolid next on Saturday while their city rivals host Eibar the following day in their penultimate top-flight home game.