A player who is almost unbeatable on clay, having won the French Open in nine of the past 10 years, proved to be more vulnerable on grass. He has now lost his last three matches on the slicker surface dating back to 2012.
Instead of chalking up his 700th tour win with victory over Brown, Nadal suffered a setback in his hopes of getting some much needed grasscourt practice before he heads to Wimbledon.
The seven-times Wimbledon champion owns more grasscourt titles (13) than any other player since tennis turned professional in 1968 but that expertise could not prevent him from dropping the first set against an opponent who has no proven track record on the surface.
The second seed, chasing a seventh title in Halle, squandered five break points in the first set against the 47th-ranked Sousa.
But Federer, who was beaten in the fourth round of the French Open by Ernests Gulbis, ran out a comfortable victor after easily winning the next two sets.
"It was slightly frustrating at times clearly, but nevertheless I served well and kept on doing my thing," Federer told reporters.
"It was important to stay calm and actually I think it gives me more confidence winning this way. I had to stay calm, fight through the match and find a way and then the last set and a half were much better. So, I'm actually pretty happy now."
Federer will face Lu Yen-hsun of Taiwan for a place in the semi-finals.
Dustin Brown (Germany) beat 1-Rafa Nadal (Spain) 6-4 6-1
Lu Yen-Hsun (Taiwan) beat Ivo Karlovic (Croatia) 7-6(2) 7-6(3)
2-Roger Federer (Switzerland) beat Joao Sousa (Portugal) 6-7(8) 6-4 6-2
Steve Johnson (US) beat Teymuraz Gabashvili (Russia) walkover
- Sports & Recreation
- Roger Federer