The hosts had got off to a flying start as goals from Sergio Escudero and Lisandro Lopez put them 2-0 up inside 14 minutes.
However, the Catalans responded like champions as Pedro scored three times in quick succession before the break.
Cesc Fabregas gave Barça breathing space when he volleyed home Pedro's cross 22 minutes from time and the former Arsenal captain doubled his tally from the penalty spot moments later.
Barça's comeback means they edge ahead of Atletico Madrid (3-2 win against Levante) on goal difference at the top of the table , whilst Real Madrid cut the gap on the top to two points with a 3-2 win at Valencia later on Sunday.
"I am just happy for the victory, the goals and to help the team," said Pedro, who also overtook Lionel Messi and Alexis Sanchez to become Barça's top scorer in La Liga with 10.
"It was important to finish the year well. It is always difficult coming here due to the way they play, the pitch and the fans.
"We didn't start how we would have hoped, but we turned the game around which is the most important thing."
Without the suspended Neymar and injured Messi, the spotlight was on the Catalans' fringe players in attack to make their claim for a regular starting spot.
Barça boss Gerardo Martino hailed Pedro's impact having previously seen his opportunities limited this season.
"Pedro has a great eye for goal, everyone in Spain knows that," said the coach.
"He has a great attitude, he never gives up and he understands that he is an important player, even if he does play in an area of the field where Barcelona have other great players."
Barça had gotten off to a disastrous start as Escudero played a wonderful one-two with Angel Lafita before firing home from close range.
Four minutes later Lisandro rose highest to power home Pedro Leon's corner to double Getafe's advantage.
Despite such a poor opening, though, Martino praised his side's patience to find a way back into the game.
"I want to stress how we maintained our way of playing and continued in the manner we had planned before the match.
"Obviously we have to analyse what happened in the first 15 minutes, but we kept our heads and didn't panic which is the Barcelona way."
The Barça revival began 10 minutes before half-time when Fabregas released Pedro in behind the defence and his chipped finish had just enough elevation to take it past Miguel Angel Moya.
Pedro then curled home into the top corner from the edge of the area and pounced on a defensive error by Juan Valera to give his side the lead at half-time.
Diego Castro should have restored parity for Getafe when he curled inches wide of the far post after turning Gerard Pique inside the area on the hour mark.
And that miss was to prove crucial as Barça killed off the contest with a wonderful team move eight minutes later that culminated with Fabregas volleying home Pedro's cross at the back post.
Pedro could have had his fourth seconds later as his attempted lob of Moya drifted just over, but he was also involved in Barça's fifth as was clipped inside the area by Borja Fernandez and Fabregas sent Moya the wrong way from the resultant spot-kick.