Liga - Messi and Xavi net in Barca win
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.
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.
Jose Mourinho's Real, on 70 points, can restore their 10-point advantage on Sunday if they can beat fourth-placed Malaga at the Bernabeu.
"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."
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 said.
"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.
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.