The winger displayed his eye for goal and followed in the footsteps of Lionel Messi by becoming the second Barca player in a week to score three goals
The 26-year-old opened the scoring in the 33rd minute when he knocked in a low cross from Lionel Messi, who was making his 250th league appearance and although Rayo enjoyed plenty of possession, the champions were clinical.
Pedro added two more similar goals in the second half, tapping in passes from Cesc Fabregas and Neymar, before former Arsenal man Fabregas added a fourth for good measure late on.
Rayo came into the match off the back of a 5-0 hammering by Malaga last weekend and coach Paco Jemez responded by making four changes.
Leonel Galeano, Nacho Martinez, Joaquin Larrivey and Seba Fernandez were all left out as Anaitz Arbilla, Johan Mojica, Raul Baena and Alberto Perea took their respective places.
After their Uefa Champions League exploits against Ajax during the week, Barca also made four changes.
Dani Alves, Andres Iniesta, Sergio Busquets and Alexis Sanchez all missed out, but coach Gerardo Martino had the luxury of being able to recall Martin Montoya, Xavi, Alex Song and Pedro.
The opening 10 minutes saw both sides create excellent chances, as Perea first headed straight at Victor Valdes, while Neymar had an effort blocked just in front of goal.
Barca, though, were clearly on top and they eventually made the most of their domination just after the half-hour mark.
Messi, who had been relatively quiet to that point, played a pass into the area for Pedro and the wide man opened up his body and placed a shot into the bottom corner.
The visitors' hard work was nearly undone three minutes later when Adriano brought Roberto Trashorras down in the penalty area, but the former Barcelona youth player's spot-kick was pushed away by Valdes.
Any threat of a Rayo upset was effectively extinguished just two minutes into the second half as Barcelona doubled their lead.
Fabregas exploited space between Tito and Arbilla down the left before squaring a ball into the danger area, which Pedro knocked into the roof of the net.
Rayo were afforded their fair share of possession, but Barcelona were the only side who looked like adding to the scoreline, as Messi found himself denied at the near post by goalkeeper Ruben.
And Martino's side put the result beyond doubt with 18 minutes remaining as Pedro completed his hat-trick in the simplest fashion, Neymar gliding past his marker and playing a square pass for the Spain international to tap in.
But there was still time for things to get even better for the visitors, as Fabregas received a pass from Xavi on the edge of the area before curling a low shot into the bottom corner to put the icing on the cake.