Alexis curled in the opener after 13 minutes and the World Player of the Year Lionel Messi netted his 39th league goal and 61st in all competitions this season before the break.
Alexis and Pedro headed in two more within three minutes of each other in the second half.
Champions Barca, who were 10 points adrift of Real just over three weeks ago, cranked up the pressure with a 10th straight win and moved to within one point on 78 from 32 games.
Jose Mourinho's men, who have drawn three of their last five, travel to play city rivals Atletico Madrid at the Calderon on Wednesday.
"We are coming back from a large disadvantage and we feel like cyclists, the most difficult part is the last kilometre and passing the person in first place," Barca sports director Andoni Zubizarreta told reporters.
Osasuna kept up their push for a place in Europe next season when Raul Garcia scored a brace in a 2-0 home win over Espanyol, who finished the game with nine men.
Osasuna were sixth with 46 points. Ninth-placed Espanyol have 42 points, while Real Sociedad and Real Betis edged further away from the relegation places with a 1-1 draw.
Pep Guardiola sent out an attacking line-up with three defenders, but without Gerard Pique and Dani Alves who had been struggling with strains, or the suspended Cesc Fabregas.
Messi's chested layoff for Alexis made the space for the in-form Chilean to tear towards the area and curl a shot inside the far post, and the chances stacked up for the hosts.
Xavi had a lob cleared off the line, which looked like it had entered the goal, and in the 22nd minute the whole stadium started chanting and applauding Eric Abidal.
The French international defender, who wears the number 22 with Barca, was undergoing a liver transplant on Tuesday having being diagnosed with a tumour on the organ last year.
"We thank everyone for the emotional applause in this minute," Zubizarreta added.
"We still don't know anything about the operation yet."
Ruben Perez had a shot deflected wide off the post for Getafe, one of only two teams to have beaten Barca this year, after a 1-0 home triumph back in November, but it was a rare foray forward.
Barca's best of the game came just before half-time when Messi worked a one-two with Andres Iniesta, the Spain midfielder backheeling into the path of the Argentine, who ripped a shot into the top corner.
During the second half, Barca eased off and controlled possession until Alexis powered in a header from Isaac Cuenca's cross in the 73rd. Pedro flicked on Messi's free-kick for the fourth soon after.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1