The Germans held their nerve to beat Fernando Verdasco and David Marrero 7-6 (5), 6-7 (9), 7-6 (7), 6-3 in 3 hours, 25 minutes, giving Spain its second straight first-round exit. Spain lost to Canada last year.
The 35-year-old Haas served out the match to give Germany its first victory over Spain since 1994, and then led the celebrations in front of the enthusiastic home crowd.
''It couldn't have gone any better. I'm very happy I was able to be here,'' Haas said. ''We're all happy and already a little bit drunk.''
Kohlschreiber and Florian Mayer won their singles against Roberto Bautista Agut and Feliciano Lopez on Friday.
''It was a great team effort,'' Germany captain Carsten Arriens said.
Germany will play France in the quarterfinals in April. France defeated Australia. Five-time champion Spain faces a World Group playoff in September.