The Catalan giants clinched their 27th Spanish championship at the home of their neighbours, 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 have endured a troubled period on and off the pitch in recent years but their 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 criticised 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's a magnificent feeling, (of) work well done," Xavi told Movistar.
"Ten months of work and sacrifice. The fans deserve it, the club, it gives us stability and security that things are being done well.
"We sealed La Liga with a fantastic game, we were brilliant."
Xavi did not spring any surprises with his line-up and Barcelona's first team took to the pitch with one goal firmly in mind, the end finally in sight.
They conjured an electric display, one of their finest this season, to seal their triumph and leave their city rivals 19th, four points from safety with four matches remaining.
Barcelona broke the deadlock after 11 minutes with a well-worked goal, finished off by Lewandowski for his 20th of the season in La Liga.
Ronald Araujo played an inch perfect long pass for left-back Balde, who blazed past Espanyol defender Oscar Gil and crossed for Lewandowski to bundle home from close range.
Gil was beaten by Balde again for the second goal, this time scored by the young left-back after Pedri darted to the byline and scooped an inviting cross to the back post.
It was Balde's first goal for Barcelona, capping a superb breakthrough season for the youngster, who has phased veteran defender Jordi Alba out of the side.
Espanyol goalkeeper Fernando Pacheco tipped away a Lewandowski effort as Barcelona poured forward, with the hosts battling not to be blown away.
'Can't lack respect'
It worked for a while, but visitors grabbed the third before half-time when Raphinha put the ball on a plate for Lewandowski to roll home.
[Quick exit: Barcelona's players leave the pitch in a hurry as Espanyol fans invade the pitch]
Quick exit: Barcelona's players leave the pitch in a hurry as Espanyol fans invade the pitch © Lluis GENE / AFP
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.
Barcelona goalkeeper Marc-Andre ter Stegen made a sublime save to deny former team-mate Martin Braithwaite from close range in stoppage time at the end of the first period.
Kounde headed home the fourth early in the second half from Frenkie de Jong's perfect chipped pass as Espanyol's defence crumbled yet again.
Some Espanyol fans headed for the exits early while others demanded the board resign, including aiming one unsavoury chant at the club's Chinese owners.
Ter Stegen denied Puado when through on goal, determined to earn a La Liga record-equalling 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 side celebrated at full-time, to the anger of Espanyol fans, who invaded the pitch, with Barcelona players sprinting down the tunnel to escape.
"The celebration is normal, but I know we're not at home and we can't lack respect," added Xavi.
"I know it's difficult to control but I told them the best thing would be to get inside now."
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)