Federer looked totally out of sorts against his Olympic doubles partner, and the 13-time Grand Slam champion failed to reach the quarterfinals at Monte Carlo for the first time since 2005.
"Like I told him, the loss doesn't hurt as much just because I know it's against a good guy,'' said Federer, who has lost the last three Monte Carlo finals to Rafael Nadal.
In 2005, Federer was upset in the quarters by French teenager Richard Gasquet.
Federer looked sloppy throughout against Wawrinka, with whom he won the gold medal at the Beijing Games, and faced 14 break points during Thursday's rain-interrupted match.
"I was making a few too many errors. That kind of gave him the advantage,'' Federer said. "I guess it was Stan's game. He did a good job today. He kept the ball in play.''
Wawrinka set up his first match point with a deep shot into the corner that the second-seeded Federer failed to return. He clinched victory with a backhand pass down the line.
"Maybe not the most spectacular tennis, but it's my most beautiful victory,'' Wawrinka said.
Top-ranked Rafael Nadal took on Nicolas Lapentti in a later match, but rain forced the players off center court after the first game, with Lapentti holding serve against the four-time defending champion to lead 1-0.
Third-seeded Novak Djokovic advanced to face No. 7 Fernando Verdasco of Spain by beating Albert Montanes of Spain 6-1, 7-6 (4), 6-0.
Federer, who needs to win one more Grand Slam title to equal Pete Sampras' record of 14 majors, was unhappy with his forehand and serve.
"Today definitely my serve wasn't working. I haven't served my best throughout the season, so I have to make sure I get my serve back in,'' Federer said. "Because I just don't hit the spots when I really want to.''
The 13th-seeded Wawrinka, who won the doubles gold in Beijing with Federer and plays alongside him on Switzerland's Davis Cup team, will next meet qualifier Andreas Beck of Germany in the quarterfinals.
"I am a bit embarrassed to celebrate it,'' Wawrinka said. "I believe (Federer) hadn't found his rhythm on clay and he made many errors.''
Federer was playing in his first tournament since getting married to longtime girlfriend Mirka Vavrinec on Saturday, and had just 10 days of practice on clay. He said he clearly needed more time to find his rhythm.
"Not that I expect 10 aces a set here on this type of heavy clay, but I just think it's something I need to work on,'' Federer said. "Make sure my timing gets right, my footwork gets right, and my forehand. It just showed me again this week what I need to work on for next week. That's why I think it was good to come here.''
Federer looked shaky from the start, saving a break point in his opening service game, before Wawrinka got the decisive break in the seventh game. Federer then sent an easy forehand into the net to give Wawrinka the first set.
The two players traded breaks to open the second set and Federer, who accepted a wild card to play in the tournament after originally planning to skip the clay-court event, had to save two more break points at 15-40 in the seventh game as Wawrinka pressured his unusually weak forehand.
Wawrinka then needed another four chances before breaking Federer again in the 11th game to serve for the match at 6-5. Although Wawrinka wobbled, Federer wasted two break points and failed to force a tiebreaker.
Also, Verdasco beat No. 10 David Ferrer 6-2, 6-1 in an all-Spanish match, and Beck rallied to beat Juan Monaco of Argentina 3-6, 6-2, 7-5.
A heavy rainstorm interrupted fourth-seeded Andy Murray's match against Italian qualifier Fabio Fognini. Murray rallied from 5-0 down to win the first set 7-6 (11), and he led 1-0, 40-40, with Fognini serving.
Robredo and Wawrinka advance at Monte Carlo
Robredo and Wawrinka advance at Monte Carlo