The Spanish skier had never placed higher than seventh in a downhill but beat Maria Hoefl-Riesch of Germany by 0.20 seconds and Frenchwoman Marie Marchand-Arvier by 0.21.
"The win feels even better because I know all the hard work I have done," Ruiz Castillo said.
Ruiz Castillo only had eight previous top-10 finishes on the World Cup, and the only top-three finish on the podium was second place in a giant slalom in 2000 at the Italian resort of Sestriere.
"It's been too long, but it's also very different, because my first (podium) was in giant," she said. "At that time I didn't know what downhill and super-G was about, I started speed events later."
Overall World Cup leader Tina Maze, who was trying to become only the third woman to win all five disciplines in a single season, was 0.28 back in fourth spot.
Maze had the fastest training run on Thursday and was second-fastest on Friday. The 29-year-old from Slovenia was attempting to join Austria's Petra Kronberger (1990-91) and Croatia's Janica Kostelic (2005-06) as the only women to win in all disciplines in a season.
"I was sure I could do that today, but I was too slow on top," Maze said. "At the bottom, I didn't attack like the first days (in training)."
She'll get another chance to win a downhill next week at Garmisch-Partenkirchen, Germany.
While her victory seemingly came out of nowhere, Ruiz Castillo said she has been building up toward it for some time.
"There's a lot of training, a lot of work behind that. This winter I've been having some good feelings," she said. "I've been working a lot on my mental strength, that's like working on your technique, your physical preparation, and it's certainly helped me a lot."
Starting late, she had a technically perfect run on the Roc de Fer course.
"I felt confident, I was quick in training," said Ruiz Castillo, who was third best in Thursday's first training run.
Marchand-Arvier made up a lot of time on the second part of the course and then watched as 10 racers failed to match her time. She looked stunned, however, when Hoefl-Riesch also made up time in the bottom section to edge her by 0.01 — ending her hopes of a first World Cup win.
Her best remains second place at Lake Louise, Canada, in December 2011. She earned her fourth World Cup downhill podium and fifth overall.
Hoefl-Riesch consolidated her second place in the overall standings but remains a massive 858 points behind Maze, having only had three podium finishes on the World Cup this season.
"I'm really, really happy with this podium," Hoefl-Riesch said. "Although it's a little bit sad that I didn't win, I was also lucky that I ended up second."
The German skier seemed convinced she had done enough to win, patting her skis several times and giving a thumbs up to the crowd in the French Alpine resort, which was hosting a World Cup race for the first time in 19 years.
"That was the first time since a long time that I was coming into the finish in the lead. It was a great feeling to see the green light," she said.
But Ruiz Castillo, the 28th to start, was well ahead on the first two time splits and kept her pace, bringing a roar of surprise from the crowd and a nod of appreciation from Hoefl-Riesch.
"I knew if she was doing the same like she did in training, she can win one day," Hoefl-Riesch said. "She deserved it. She was fighting for a long time."