The Katusha rider spent the day in the break and emerged the stage leader with seven kilometres left to race before riding solo to the finish on a wet and wild day of racing.
Second and third positions on the stage were filled by Jakob Fuglsang (Astana) and Romain Bardet (AG2R).
Race leader Chris Froome (Team Sky) emerged unscathed after a series of probing attacks by Alejandro Valverde and Nairo Quintana (Movistar), Vincenzo Nibali (Astana) and Alberto Contador (Tinkoff-Saxo) in the final kilometres of the Plateu de Beille climb.
Twenty-two riders carved out the break of the day, including Rodriguez, Fuglsang, Bardet, Michal Kwiatkowski (Etixx-QuickStep), Sep Vanmarcke (LottoNL-Jumbo) and Georg Preidler (Giant-Alpecin).
The group traversed the Col de Porte-d’Aspet and Col de la Core together but fractured into several groups on the Port de Lers when Kwiatkowski, Vanmarcke and Preidler separated themselves from the rest.
Kwiatkowski and Vanmarcke crested the climb first with a smaller group from the original break active in the chase on the descent.
Kwiatkowski eventually dropped Preidler and Vanmarcke on the Plateau de Beille, but a strong chase and catch by Rodriguez after some cat and mouse with Fuglsang and Bardet put the Katusha rider into the race lead with seven kilometres to go.
From that point it was clear sailing for the veteran Spaniard, who added to his punchy Stage 3 victory with a gritty and determined effort on a high mountain.
"After my bad last two days with hunger and a crash, to go in the break appeared to be a good move," Rodriguez said. "First I thought it would be a bad move as we had only four minutes for quite a while because there was no ideal co-operation in our group, but then that got better.
"On Plateau de Beille I felt fantastic. I saw soon that Fuglsang would be the hardest competition but when I attacked and I saw his face I knew everything. I decided to go three kilometres at 200 per cent to permanently drop him."
Team Sky, Tinkoff-Saxo and Movistar controlled the pace of the peloton as it hit the base of the Plateau de Beille and, as the climb progressed, passed the stragglers from the earlier 22-rider break while shedding riders too fatigued to keep up.
Froome was well serviced by team-mates Richie Porte and Geraint Thomas as they kept the pace high enough to blunt any serious adventurism from their rivals.
A series of probing attacks designed to isolate Froome were initiated by Valverde, shook Porte loose and briefly put Thomas in trouble. But the man in yellow was always able to cover the moves himself.
"It is a miracle," said Rodriguez after his win. "Everybody wants to win this stage. Plateau de Beille is a climb I really like. I live 50km from here and I am used to climbing here. I have family and friends here and saw many people with 'Purito' t-shirts. That helped me a lot."
The nickname, 'Purito' is Spanish for 'little cigar'.
"Honestly I did not suffer any more those last five kilometres. On the contrary I enjoyed them with all my friends on the road and when Torsten Schmidt behind me in the car told me that I had 40 seconds it gave me wings. I could maintain my rhythm and knew I would win.
"It is a dream, especially as it was a hard stage with the weather: first hot and then cold and then the dangerous descents," he said.
"I came here for the GC but now I’ve won two stages," he added. "I think for the team this is just as important. And also I’m starting to like this more than fighting for a fifth or sixth place in GC. This is one of my best Tours ever."