information:highlighting
2018: 20th major title and oldest No. 1

Federer started his season by winning his second Hopman Cup title, this time partnering with Belinda Bencic, after having won previously in 2001 with Martina Hingis. The Swiss team won all its ties and Federer won every match he played, defeating the German pair, Alexander Zverev and Angelique Kerber, in the final 2–1. At the Australian Open, Federer reached the final without dropping a set, and successfully defended his title beating Marin Čilić in a five-set final. It was Federer's sixth title at the Australian Open, equaling the then record held by Roy Emerson and Novak Djokovic, which was surpassed by Djokovic in 2019. He also became the first man to win twenty Grand Slam titles. It was also the first time since the 2008 US Open that Federer successfully defended a major title.

In mid-February, Federer defeated Grigor Dimitrov to win his third Rotterdam Open title and return to No. 1 in the ATP rankings. At 36 years and 195 days of age, he became the oldest ATP world No. 1 by more than three years, a record that stood until Novak Djokovic broke the record in 2024. He also broke the ATP record for the longest span between two successive reigns at No. 1 at 5 years and 106 days. In March, Federer entered the Indian Wells Masters, where he defeated Chung Hyeon in the semifinals for a career-best start to a season at 17–0, beating his previous best start at 16–0 in 2006. Despite holding three championship points, Federer was defeated by Juan Martín del Potro in a close three-set final. After a second-round exit to Thanasi Kokkinakis in Miami, Federer announced that he would miss the clay court season, including the French Open, for the second consecutive season, thus allowing Nadal to regain his No. 1 ranking.

In June, Federer regained the No. 1 ranking at the Stuttgart Open, which he won after defeating Milos Raonic in the final. However, he lost his No. 1 ranking for the last time in the following week when he failed to defend his Halle Open title, losing in the final to Borna Ćorić in three sets. At Wimbledon, Federer was seeded first at a Grand Slam for the first time since the 2012 US Open, but he lost in the quarterfinals to Kevin Anderson in five sets, despite being two sets up and having a match point in the third.

Federer next played in Cincinnati, where he lost in the final to Novak Djokovic, who won a record Career Golden Masters. The loss ended Federer's run of 100 consecutive service holds and 14-match winning streak in Cincinnati. At the US Open, Federer was upset by John Millman in the 4th round, citing extreme conditions of heat and humidity that took a toll on his body. Federer then played at the Laver Cup where he successfully helped Team Europe defend their title, winning both his singles matches against Nick Kyrgios and John Isner. He also paired up with Djokovic in doubles for the first time in his career, losing their match against Jack Sock and Kevin Anderson in three sets.

At the Swiss Indoors in October, Federer defended his title with a straight-sets win over Marius Copil in the final, winning his 9th title at the event and his 99th career singles title. At the Paris Masters, Federer lost in the semifinals to Djokovic. At the ATP Finals, Federer lost in straight sets to Alexander Zverev in the semifinal.