Losses to Barcelona and Sevilla - the first time Madrid have suffered successive defeats in La Liga since the 2008/09 season - over the past seven days had badly hit their title hopes, but Carlo Ancelotti's men got their campaign back on track in style with a 5-0 win.
Cristiano Ronaldo's early strike was all that separated the sides at the break, but Madrid cut loose in the second half with Bale netting his first goals in seven games while Daniel Carvajal and substitute Alvaro Morata were also on the mark.
The victory, which should have been even larger, keeps Madrid within three points of leaders Atletico Madrid and two behind Barca, both of whom won testing away matches on Saturday.
Madrid would have been desperate for a flying start against in-form Rayo, and they almost got it with Karim Benzema seeing his close-range effort parried by Rayo keeper Ruben Martinez inside the opening two minutes.
The home side did not have to wait much longer to go ahead though, with Ronaldo taking Bale's pass in his stride as he burst into the area before slotting past Ruben.
That was Ronaldo's 28th league goal of the campaign, and should really have opened the floodgates for the hosts against a Rayo defence whose record of 63 goals conceded was comfortably the worst in the division,.
However, they had to settle for just the one-goal lead at the break as Benzema and Bale both spurned great chances.
Benzema decided against shooting first time with only Ruben to beat and his control badly let him down, before Bale was left red-faced when he raced clean through on goal only to go sprawling after stubbing his foot into the pitch as he attempted to shoot.
Madrid finally got the second goal they would have been eager for to ease any tension nine minutes after half-time, and it came from an unusual source.
Star attackers Bale and Ronaldo were both involved, but it was right-back Carvajal who got on the scoresheet as he slotted home the FIFA Ballon d'Or winner's lay-back.
Rayo briefly threatened a recovery, Saul Niguez heading a deep corner against the outside of the post before Jonathan Viera curled a free-kick inches wide, but Madrid snuffed out that threat with a quickfire double from Bale.
The two goals were in stark contrast to each other, with his first being a close range tap-in from a Di Maria cross, and his second seeing the world's most expensive player race from deep inside his own half, bundle his way through one challenge, before coolly slotting past Ruben.
That was not the goal of the night, though.
That accolade fell to the freshly shaven-headed Morata, who curled home a brilliant effort from the edge of the area with 12 minutes to go.
Madrid had chances to score more in the closing stages - and match the 6-0 win Barca inflicted on Rayo last month - but they had to settle for just the five as they ended a bad week on a more positive note.