However, Johansson and Aspelin failed to take their chances and the Swiss went two sets up.
Federer switched service ends in order to serve again at the beginning of the third set, but a poor overhead and a wayward volley allowed their opponents to break him for the first time in the match.
The Swedes were still not firing on all cylinders themselves, however, and three double-faults by Aspelin meant the Swiss were able to break back.
It took a tie-break, which Johansson and Aspelin won, to decide the third set.
A brilliant reaction volley from Federer helped break Aspelin again at the start of the fourth set, Federer eventually serving out the match.
The 27-year-old, who has won 12 Grand Slam singles titles, celebrated victory by throwing up his hands and jumping up and down before embracing Wawrinka.
Bookmark with:
What are these?