With his victory over Gilles Simon at the Shanghai Rolex Masters, Roger Federer moved to No. 2 in the ATP rankings, just 990 points behind Novak Djokovic in the year-to-date points race. That puts the 33-year-old Federer within striking distance of the year-end No. 1 ranking, something that would be improbable both at his advanced age and with nary a Grand Slam title on his 2014 résumé.

This isn’t some pie-in-the-sky notion either. Federer’s ascension to No. 1, while not probable, is very possible. Djokovic is scheduled to play two more tournaments this year: The BNP Paribas Masters in Paris and the year-end ATP World Tour Finals. Federer is scheduled to play those same tournaments, in addition to a 500-level event in his hometown of Basel. If Federer can advance deep into each of his tournaments, while outlasting Djokovic at in Paris andLondon, he could easily finish the year at No. 1. But will he?

There are hundreds of different scenarios and none should be taken for granted. Remember, Federer saved five match points in his opening match against Leonardo Mayer last week in Shanghai, then went on to win the tournament. If any of those points went Mayer’s way, Federer is still No. 3 in the world and Djokovic is cruising to another year-end No. 1. As such, this could all end very quickly. If Federer loses in the opening round in Paris while Djokovic takes the title, the race is over before it begins. Then again, if Federer wins out, he passes Djokovic no matter what results the Serbian has.

But these are extreme (though not impossible) examples. This post attempts to build the likeliest, most realistic, road map for how Federer could become the improbable year-end No. 1.

Basel

Federer has made the finals in his last eight appearances in Basel, going 37-3 overall with five titles. Assuming Djokovic doesn’t add anything to his schedule (and with his wife expecting their first child in the coming weeks, that’s a fair assumption), Federer is earning free points in Basel. How many will he get?

History says he’s good for at least the 300 points given to the runner-up, as he hasn’t been ousted before the final since 2003. With Rafael Nadal on the other side of the draw, Federer’s path shouldn’t be difficult, but it could involve seeing fellow Swiss player Stan Wawrinka in the semifinals. Though finishing No. 1 isn’t dependent on a title in Basel, it’s part of the most plausible path. So we’ll give Federer the Basel title and see what happens.

Federer: 500 points (win); Net gain: 500 points; Deficit: 490 points.

Paris

Djokovic isn’t a stationary target. He’s a player who’s 33-5 since the start of the French Open and figures to keep up his strong play through the end of the season. That’s why it’s not reasonable to assume Federer will keep outlasting Djokovic at every tournament. That’s no slight to Roger, just all respect due to Novak.

The thing is, Djokovic hasn’t been historically great in Paris. He won in 2009 and 2013, with those victories bookending R16, Q, R32 exits. Then again, Federer hasn’t been great either. He won in 2011, had two semifinal appearances in 2010 and 2013, but had early exits in the tournament during his prime.

Let’s give Djokovic the advantage in Paris, while predicting an underperformance from both the Nos. 1 and 2 players.

Djokovic: 360 points (SF)

Federer: 180 points (QF); Net gain: -180 points; Deficit: 670 points

ATP World Tour Finals

If Federer is going to snatch No. 1 away from Djokovic, the bulk of the work would have to happen in London. Echoing the same sentiment from earlier, a Federer victory here isn’t do-or-die, but considerably out-earning Djokovic in rankings points is. With these two almost certain to be in different round-robin draws, let’s say both advance to the knockout rounds, then meet in a epic final with the year-end No. 1 on the line. Here’s the kicker though: Under this scenario, Federer could beat Djokovic in the final and still not pass him for No. 1.

Djokovic: 800 points (two round-robin wins, loss in final)

Federer: 1,300 points (two round-robin wins, tournament champion); Net gain: 500 points; Deficit: 170 points

Davis Cup

This is the X-factor. Federer is still alive in the Davis Cup. Djokovic is not. The bonus points Federer could receive by playing in the final might provide the narrow difference. Federer can get 75 points per singles win over the French team. That’s 150 points. Those two wins, coupled with a Swiss victory, would also trigger a 75-point bonus, according to the Davis Cup rankings points bylaws. If the Swiss win their first-ever Davis Cup, anchored by two Federer singles win, that would be enough to get Roger back to No. 1.

Federer: 225 points (two wins and Davis Cup title); Net gain: 225 points; Finishes No. 1 by 55 points.

That was the long answer. Here’s the shorter one: If Djokovic wins either of his final two tournaments, he’ll finish No. 1. If Federer wins one of his final three, plus a Davis Cup, and keeps up his solid play, there’s a very good chance he pulls the No. 1 stunner.