A Dani Alves own goal was enough to take Switzerland past Brazil as Luiz Felipe Scolari's side lost their first match since winning the Confederations Cup.
The South American side beat world and European champions Spain in June to lift the FIFA trophy on home soil.
But although they dominated at a packed Jakob Park stadium in Basle, they failed to take their chances allowing the Swiss hosts to snatch the narrowest of wins.
Brazil looked in control from the opening minutes and had several opportunities to open the scoring, but both Hulk and Oscar were wasteful in front of goal.
Paulinho came even closer to breaking the deadlock after 36 minutes when he headed Neymar's long ball forward against the crossbar.
A Brazilian player eventually found the back of the net early in the second half, but not to the benefit of the visitors.
Haris Seferovic pumped the ball into the area, where Barcelona defender Dani Alves tried his best to clear the danger but only succeeded in turning his header into his own net.
Further attempts to score at the right end came to nothing for Brazil, as Scolari suffered only his second defeat since returning to the helm.