The Catalan giants clinched their 27th Spanish championship at the home of their neighbors, with scenes turning ugly at full time as celebrating Barcelona players were chased from the field by pitch invaders.
Robert Lewandowski struck twice for Barcelona, along with goals for Alejandro Balde and Jules Kounde, while Javi Puado and Joselu pulled two back late on for the hosts.
Barcelona has endured a troubled period on and off the field in recent years, but the triumph signals significant improvement, with coach Xavi Hernandez winning his first major trophy since taking over in November 2021. President Joan Laporta's rebuild was widely criticized last summer in light of the club's perilous financial situation.
Early Champions League elimination was a blow, but the club won the Spanish Super Cup in January, before sealing La Liga glory with four games to spare.
"It was a very emotional moment, a moment very hard not to celebrate after so many months of work," said Xavi. "We didn't celebrate just because it was Espanyol's stadium."
The coach said that the victory was proof that the club was heading in the right direction.
"(It brings) a lot of calm, a lot of hope for the future," said Xavi. "I am very happy. We did a great job, a league won with four games remaining, that's to the absolute merit of the team."
Xavi did not spring any surprises with his lineup, and Barcelona's first team took to the field with one goal firmly in mind, the end finally in sight.
It conjured an electric display, one of its finest this season, to seal its triumph and leave its city rivals 19th, four points from safety with four matches remaining.
Barcelona took the lead through Lewandowski, finishing from close range after a fine Alejandro Balde assist.
The left back scored the second himself, with Pedri scooping a cross to the back post for him to pounce. Barca grabbed the third before halftime when Raphinha put the ball on a plate for Lewandowski to roll home.
The Polish striker's arrival from Bayern Munich was a key part of last summer's rebuild and despite a dip in the second half of the season, has paid the Catalans back in goals.
Raphinha, who joined from Leeds, played superbly against Espanyol and has been an important figure in the second half of the season with Ousmane Dembele sidelined for a long stretch.
"I am very happy and not just for myself, the whole team worked so hard," said Raphinha. "Only a few of us had won the league, it's the first for a lot of players, it's special. We worked so hard for this."
Kounde headed home the fourth early in the second half from Frenkie de Jong's perfect chipped pass as Espanyol's defense crumbled yet again.
Some Espanyol fans headed for the exits early while others demanded the board resign, including aiming one unsavory chant at the club's Chinese owners.
Barcelona goalkeeper Marc-Andre ter Stegen denied Puado when through on goal, determined to earn a La Liga record-equaling 26th clean sheet of the season in the top flight.
However, moments later the Espanyol forward found himself through on goal once more and this time scored with a sublime lob -- small consolation in the face of Espanyol's defeat and Barcelona's glory. Joselu pulled another goal back in stoppage time, but it was too little, too late.
Xavi's players celebrated at full-time, to the anger of Espanyol fans, who invaded the field, sending the visiting players sprinting down the tunnel to escape.
"I haven't seen the images, I always go in at the end of a game and from what I've been told, it's something that should not happen and should be condemned," said Espanyol coach Luis Garcia. "Measures were in place to avoid it, but it was not possible."
Earlier, Atletico Madrid fell to a surprise 1-0 defeat at relegated Elche.
Valencia snatched an important late victory at Celta Vigo to climb provisionally to 14th, three points above the relegation zone.
© Agence France-Presse