The Spanish international rewarded the visitors' bright start when he slotted from after some brilliant play by Lionel Messi on the half hour mark yesterday.
However, just as in recent weeks, Barca were thankful to goalkeeper Victor Valdes for keeping them in front as he saved his second penalty in as many games when he palmed away Roberto Trashorras' effort 10 minutes before half-time.
That was to be the turning point as Pedro added a second barely two minutes into the second-half before sealing his hat-trick 13 minutes from time.
"We know that Vallecas is a difficult place to come. They have a competitive team, but we managed to find the spaces and score the goals," Pedro told Gol TV afterwards.
Also Read
"I am happy with the overall work of the team. In the personal aspect, obviously I am happy too, but I need to give my thanks to my teammates," he added after receiving a trio of fine assists from Messi, Neymar and Fabregas.
Rayo had conceded 14 goals in their last three games and 12 in their previous two meetings at home to Barca, but they had the first clear chance of the game on three minutes as Johan Mojica's cross was met by the unmarked Alberto Perea and Valdes was forced into a fine save.
Neymar then had two great chances to score his first league goal for Barca, but he was denied by a goal-line clearance from Tito and then fired wide following a great turn and pass by Messi.