Alves put through his own net at the start of the second half to give the feisty Swiss just reward for taking the match to the irritable 2014 World Cup hosts.
Far from being overawed by facing a Brazil side who demolished Spain 3-0 in the Confederations Cup final in June, unsung Switzerland's hard tackling and cheeky skills clearly unnerved the South Americans.
Brazil won all five matches at the Confederations Cup and beat France 3-0 in a friendly before that tournament.
However, Brazil coach Luiz Felipe Scolari was unruffled by the shock defeat.
Switzerland quickly got under the visitors' skin as Stephan Lichtensteiner tangled with Neymar and the impish Shaqiri repeatedly jinked around Brazilian defenders, who clearly did not enjoy being on the receiving end of some trickery.
"The result was not a surprise because we weren't match fit and we were facing a team whose players have completed their pre-season and are in much better shape than ours," 'Big Phil' said.
"This (August date) is an impossible date to play and it appears to me that from next year, FIFA will remove it.
"We wanted more, we wanted to win, we had chances, we had more chances to score. But it's within our expectations and what I told you before the game and, as I told you, we have a long way to go before the World Cup."
His opposite number Ottmar Hitzfeld refused to get carried away and said next month's World Cup qualifier at home to Iceland would be a stiffer test.
"Every win is good for the self-confidence but the most important now are three points against Iceland when there will be more pressure," said the German.
Tempers frayed midway through the first half when a rash challenge by Neymar led to a scuffle on the touchline and yellow cards for the Brazilian and Valon Behrami.
Marcelo was then lucky to escape a booking for a rough tackle on Shaqiri.
Having threatened several times in the first half, Switzerland went ahead in the 47th minute when Hans Seferovic crossed from the right and Alves, under no real pressure, headed into his own goal at the far post.
Brazil nearly gave another goal away when goalkeeper Jefferson slipped as he attempted to clear an awkward Dante back pass, but he recovered just in time to scramble the ball away from the lurking Seferovic.
Shaqiri was a show apart as he twice tested Jefferson with lone-range shots in the first-half and nearly scored a second with a rasping drive midway through the second.
There were some flashes from Neymar early on while Paulinho headed against the crossbar and Oscar should have opened the scoring when he went clear just before the break.