Xavi curled a shot over wall after 18 minutes and World Player of the Year Messi bagged his 31st of the league campaign soon after.
The Argentine started the move deep in midfield playing a one-two with Andres Iniesta, he nutmegged a defender as he skipped into the area, and calmly lifted the ball over the advancing Andres Palop.
Having carved a host of first-half chances, however, Barca spent much of the second period pegged back as both goalkeepers Palop and Victor Valdes made top-class saves.
The champions held firm and moved on to 63 points from 27 games.
"We played very well in the first half and we scored two goals and could have got more, but the second half was a different story," Pique told Spanish television.
"We have done our job now we need to see what happens tomorrow. At least they [Real] go out knowing we are there behind them and we are still in the fight."
FORGET ABOUT LEAGUE
Barca coach Pep Guardiola sounded a more pessimistic note when he was asked about the side's chances of catching Real to win their fourth consecutive league crown.
"You should forget about this league, we aren't going to win it," he told reporters.
"If there is one thing about this team, it is that it is competitive, but there is another team that has achieved better results than us."
Both sides came out at the start of the match wearing shirts in support of Barcelona's French defender Eric Abidal, who found out he needed a liver transplant during the week.
When asked about Abidal Barca's Argentine defender Javier Mascherano told Spanish television: "I don't like to mix football with things that happen off the pitch, but if the victory serves to give him a lift, all well and good."
Osasuna climbed to fifth with 29 points after grabbing a late equaliser to draw 1-1 at basement side Real Zaragoza.
Portugal striker Helder Postiga had struck from outside the area to give Zaragoza the lead with five minutes to go but three minutes later Osasuna defender Roversio headed in from a corner.
Rayo Vallecano climbed to eighth with 37 points after beating another promoted club Real Betis 3-0 in the late game, with second-half goals from Emiliano Armenteros, Diego Costa and Raul Tamudo
Zaragoza stayed 20th with 19 points, eight short of safety and five behind 19th-placed Sporting Gijon.
Sporting, whose 62-year-old coach Javier Clemente was celebrating his 500th game in La Liga, lost 2-1 at fellow strugglers Granada to first-half strikes from Carlos Martins and Guilherme Siqueira.
Real Sociedad's Inigo Martinez put the ball in his own net to give Getafe a 1-0 home win.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.