Pedro struck a hat-trick while Victor Valdes saved another penalty as Barcelona beat Rayo Vallecano 4-0 in La Liga.