Gerardo Martino's men trailed 2-0 but completed the remarkable turnaround thanks to three goals in nine minutes from the winger, plus a Cesc Fabregas brace.
The winger shrugged off the absence of Lionel Messi and Neymar to take center stage, scoring the club's fastest league hat trick since Dani's in September 1999 to move to 10 league goals for the season.
Getafe had taken a surprise lead after 10 minutes when Sergio Escudero beat Jose Pinto from close range following good work by Angel Lafita to create the chance. And things went from bad to worse for the defending champions when Lisandro Lopez headed home unmarked from a corner four minutes later.
However, Barca showed their fighting qualities as Pedro struck three times in quick succession to hand his side what had at one stage appeared an unlikely lead at the break.
Cesc Fabregas added a fourth in the 68th minute and converted a penalty in the 72nd from time to complete his brace and round off the scoring.
Neymar was ruled out with suspension, while Gerardo Martino was also without Messi and Xavi due to injury. However, the visitors were boosted by the return of Dani Alves following a calf injury, with Pedro and Alexis Sanchez called on to supply Barca's firepower.
Borja Fernandez came in for Getafe, replacing Mehdi Lacen, who dropped to the bench.
Barca threatened from the start as Gerard Pique forced Miguel Moya into a smart save from close range after just two minutes. But, against the run of play, the hosts took the lead with a well-worked move as Escudero applied the finish to Lafita's neat backheel.
Getafe, which was beaten 4-1 in the corresponding fixture last season, doubled its lead after 14 minutes thanks to Lopez's header, leaving Martino's men stunned.
Pedro looked to have pulled a goal back before the half-hour mark but was denied by the offside flag. It mattered little, though, as the Spain international produced a stunning quick-fire treble to turn the match on its head.
The first arrived after 34 minutes when, having been played in by Fabregas, the forward hoisted the ball over Moya. Pedro completed his hat trick before the interval, cutting in from the left and firing into the far corner for his second and finishing emphatically inside the area for the third.
Getafe started the second half strongly and almost levelled 14 minutes in, with Diego Castro outsmarting Pique in the box and curling an effort wide of Pinto's right-hand post.
However, despite the home side's endeavor, Barca's cutting edge proved too much for Getafe to cope with as Fabregas volleyed home Pedro's cross at the far post to move two goals clear.
The midfielder added a second from the spot three minutes later after Pedro was felled in the box by Borja, with Barcelona able to comfortably see out the game and ensure it goes into the winter break top of the league on goal difference.