Real's push for a 33rd league crown suffered a damaging week as their 4-3 Clasico defeat to Barcelona was quickly followed by a 2-1 loss at Sevilla on Wednesday, but Bale – who received considerable criticism for his midweek display – provided the perfect answer by scoring twice on Saturday.
With championship rivals Barcelona and Atletico Madrid having both won earlier in the day, it was an emphatic response from Real.
Carlo Ancelotti called for focus after the defeat in Seville and the hosts settled any early nerves with a 15th-minute goal; Cristiano Ronaldo tapping in from Bale's pass.
The second arrived in the 55th minute as Dani Carvajal scored his first La Liga goal and Bale added number three, ending a run of six Real matches without scoring.
Bale doubled his personally tally for the match with 20 minutes to go, netting after a delightful run from his own half, and Alvaro Morata grabbed the final goal with just over 10 minutes to go, lifting Real to within three points of Atletico.
Ronaldo started for the hosts despite slight concerns over a knee issue, while Ancelotti was also able to call upon Sergio Ramos once again following his controversial sending off in El Clasico.
Real threatened from the start and almost took a third-minute lead as Ronaldo played a clever square pass into the danger zone for Karim Benzema, but he fired straight at Ruben.
They were successful in beating the goalkeeper 12 minutes later, though, as Ronaldo latched on to Bale's precise reverse pass before bursting into the area and coolly slotting into the bottom-left corner.
Benzema should have doubled their lead with 26 minutes on the clock as he looked all set to tap Bale's low cross in from point-blank range, but his touch deserted him at the crucial moment.
Bale was presented with a great opportunity seven minutes before the break, but after racing through on goal, he stumbled and fell when shaping to shoot.
Rayo looked lively at the start of the second half, with right-winger Jose Carlos looking particularly dangerous, but the hosts effectively put the match beyond Paco Jemez's men in the 55th minute.
Bale produced a pin-point low cross into the area for Ronaldo and the Portugal star unselfishly played a first-time pass back to the advancing Carvajal, who subsequently stroked past Ruben.
Rayo almost hit back immediately, but Atletico-owned Saul Niguez could only head Carlos' corner on to Diego Lopez's right-hand post.
With 20 minutes left, Bale struck twice in quick succession; first tapping in Angel Di Maria's assist, before netting a brilliant second, bursting all the way from his own half to confidently find the net from just inside the box.
Just in case the result was in any doubt, substitute Morata grabbed the fifth with an audacious curling effort from distance, giving Ancelotti the response that he had demanded.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.