Brazil trailed 2-0 in the first-round series after dropping both of Friday's single matches, but stayed alive Saturday when the doubles team of Marcelo Melo and Bruno Soares bounced the top-ranked American tandem of Bob and Mike Bryan.
Querrey, however, finally put the United States into April's quarterfinals with a 4-6, 6-3, 6-4, 7-6 (6-3) triumph over Alves, firing 26 aces in a 2-hour, 37-minute effort.
The 32-time champion Americans -- who fell to Spain in last year's semifinals -- now go on to meet Serbia in the quarters.
Senate Democrats to pull all-nighter on climate change
Jessica Simpson shares three-way kiss with friends in photo