Luis Suarez scored the only goal of the game at Camp Nou in the 56th minute, and Barca moved within one point of Madrid, who can restore their four-point advantage when they host Alaves on Friday.
Prior to Suarez's goal, both Ansu Fati and Pol Lozano had been sent off. Ansu was dismissed just four minutes after coming on for a high boot, and Lozano saw red for a studs-up challenge on Gerard Pique.
There will be complaints about the performance, but the important thing at this stage is the result. Barca did just enough to get over the line and keep their hopes of winning the league alive. They still need Madrid to drop points at least twice in their final four games, but they're clinging on.
Fireworks were set off outside Camp Nou as Espanyol, the city of Barcelona's other team, became the first side relegated this season, ending a 26-year top-flight stay. Barca will celebrate Espanyol's demise, but they will miss them when they're gone. The Catalan derby is a fixture to look forward to, even if it isn't as competitive as its Madrid or Seville counterparts.
The formation that thrilled against Villarreal at the weekend -- Suarez and Antoine Griezmann up front with Lionel Messi behind them -- was not as effective against Espanyol's deep block. Coach Quique Setien might not have found the magic formula after all, though the three did link for the goal.
It was also a bad night for the club's youngsters. Ansu came on half-time but was immediately sent off, and Riqui Puig, who has impressed in recent weeks, didn't feature.
Manager rating out of 10
5 -- Setien was right to stick with the formation that worked against Villarreal, and he was also quick to react, bringing Ansu on at the break. The teenager was soon sent off, though, so we never got to see if his all-out attack approach would have worked.
Player ratings (1-10; 10 = best, players introduced after 70 minutes get no rating)
GK Marc ter Stegen, 8 -- Started the game with a fine save from Adri Embarba and ended it with another one from Raul de Tomas. As reliable as ever between the posts.
DF Nelson Semedo, 5 -- Tried to exploit the space on the right with Messi and Griezmann taking up central positions. Sacrificed at half-time for Ansu.
DF Gerard Pique, 6 -- The image of him turning up at Camp Nou on his bicycle pregame was more memorable than anything he did during the 90 minutes.
DF Clement Lenglet, 6 -- Like Pique, didn't particularly stand out but made a few important interceptions.
DF Jordi Alba, 6 -- Didn't get forward as well as he did against Villarreal, mainly because of the amount of Espanyol bodies ahead of him.
MF Sergio Busquets, 7 -- One of the best performers since Setien came in. Well-positioned and good on the ball again.
MF Ivan Rakitic, 6 -- Helped keep the team's shape but lacked creativity going forward.
MF Sergi Roberto, 6 -- Split his time between midfield and right-back again, even though he has made it clear that he'd rather play in the middle.
FW Lionel Messi, 7 -- Up against a block of Espanyol shirts every time he got the ball. Managed to draw a fine save from Diego Lopez with a stunning volley and helped set up Suarez's goal.
FW Luis Suarez, 6 -- Missed Barca's best chance of the first half but has a knack for scoring goals and opened the scoring with his side's first shot on target. Has now scored 195 goals since joining from Liverpool in 2014, making him the club's third top goal scorer of all time.
FW Antoine Griezmann, 6 -- His incisive pass created a one-on-one for Suarez in the first half, and he was involved in the goal with a nice back heel to Messi. Headed his best chance over in the 54th minute.
FW Ansu Fati, N/R -- Came on in the 45th minute and was sent off in the 50th. A game to forget and a suspension to come.
MF Arturo Vidal, N/R -- Survived a late penalty scare when the ball struck the top of his arm in the box, but nothing was given.
FW Martin Braithwaite, N/R -- A willing runner and hard worker in the 10 minutes he was on. Should have been brought on earlier.
DF Ronald Araujo, N/R -- Replaced Rakitic in stoppage time.