© AP Photos
The hosts dominated proceedings in the opening minutes and went close in the 11th minute when Lionel Messi rattled the crossbar with a free kick.
Barca's pressure finally paid off after 25 minutes when David Villa fired in from close range after receiving Messi's pass to put them in the lead.
Alexis Sanchez could have added to the tally seven minutes into the second half when his shot went out for a goal kick after hitting the inside of the Rayo post.
The Blaugrana did not have to wait long, though, for their third goal at Camp Nou, and it came just five minutes later.
Villa and Messi once again combined with each other, the Argentine chipping over Ruben after collecting the final ball from the Spain international.