The 2017 Mexico City ePrix (officially the 2017 FIA Formula E Julius Baer Mexico City ePrix) was a Formula E electric car race held on 1 April 2017 before a crowd of 36,000 people at the Autódromo Hermanos Rodríguez in Mexico City, Mexico. It was the fourth round of the 2016–17 Formula E Championship and the second Mexico City ePrix. The 45-lap race was won by Audi Sport ABT driver Lucas di Grassi after starting from 15th position. Techeetah's Jean-Éric Vergne finished second and Virgin driver Sam Bird was third.
 Oliver Turvey took pole position after Daniel Abt was penalised for a tyre pressure infringement and held off pressure from José María López to lead the field until he retired from the race with power issues, handing the lead to López. Di Grassi and Jérôme d'Ambrosio made early pit stops to switch into their second cars and di Grassi took the lead on lap 26 when the rest of the field made their stops. D'Ambrosio held off Vergne for second place until lap 43 as di Grassi held the lead for the rest of the race by conserving electrical energy to win. There were three lead changes among four different drivers and three safety car periods during the course of the race.
 It was di Grassi's first victory of the season and the fifth of his career. The result reduced Sébastien Buemi's lead over di Grassi in the Drivers' Championship from 29 to five after finishing 14th, but earned one point for setting the race's fastest lap. Nico Prost and Vergne remained in third and fourth places while Bird passed Felix Rosenqvist for fifth. Audi Sport ABT drew to within 31 points of e.Dams-Renault in the Teams' Championship, while Virgin moved from sixth to third with eight races left in the season.
 The Mexico City ePrix was confirmed as part of Formula E's 2016–17 schedule in September 2016 by the FIA World Motor Sport Council. It was the fourth of twelve scheduled single-seater electric car races of the 2016–17 Championship, the second Mexico City ePrix, and was held on 1 April 2017 at the Autódromo Hermanos Rodríguez. The ePrix was the only race of the season held on a permanent race track consisting of a mixture between the Grand Prix and oval layouts, and is 2.093 km (1.301 mi) long with 17 corners running in a clockwise direction. The circuit was changed after the 2016 race with the first corner changed to a right-hand turn and the final chicane was modified to prevent drivers from short-cutting the corner in order to gain an advantage.
 Before the race, e.Dams-Renault driver Sébastien Buemi led the Drivers' Championship with 75 points, ahead of Lucas di Grassi in second and third-placed Nico Prost. Jean-Éric Vergne was fourth on 22 points and Felix Rosenqvist was fifth with 20 points. e.Dams-Renault led the Teams' Championship with 111 points; Audi Sport ABT were in second place on 60 points, and Mahindra in third with 37 points. NextEV stood in fourth on 25 points and were three points ahead of Techeetah in fifth.
 After losing the victory in the 2016 race because of an underweight car, Audi Sport ABT team principal Hans-Jurgen Abt said his team's objective was to get onto the podium. He acknowledged that winning would not be easy because of the competitiveness in the field. After retiring from the preceding Buenos Aires ePrix, Sam Bird said he would go into the Mexico City race with a positive attitude and felt there was a possibility of getting onto the podium if his team did well in qualifying. Mitch Evans reiterated that despite Jaguar not scoring points in the season's opening three races, the Buenos Aires race showed that he was becoming more confident and wanted to carry over his momentum from the four-month break. 
 A total of ten teams each entered two drivers for a total of 20 competitors. There was one pre-race driver change. Having been in one of the Techeetah cars since the opening round of the season in Hong Kong, Ma Qinghua was replaced by the former Haas driver Esteban Gutiérrez. Gutiérrez announced he was entering the series in January 2017 and explored seats with three teams before signing a contract with Techeetah. The change was prompted because of Ma's poor performance in the seven races he competed in Formula E, but remained with Techeetah as their third driver. Buemi, Stéphane Sarrazin (Venturi) and José María López (Virgin) missed the shakedown session because they attended the launch of the 2017 Toyota TS050 Hybrid at the Autodromo Nazionale di Monza. The latter two were deputised by defending Formula V8 3.5 Series champion Tom Dillmann and former GP2 Series driver Alex Lynn.
 Two practice sessions—both on Saturday morning—were held before the Saturday late afternoon race. The first session ran for 45 minutes; the second for 30 minutes. The 30-minute shakedown session took place on Friday afternoon and saw Bird record the fastest lap of 1 minute, 8.737 seconds. Evans and Oliver Turvey were second and third. Vergne and his teammate Gutiérrez incurred three-place suspended grid penalties for exceeding their electrical power allowance under full course yellow conditions in shakedown. Both practice sessions took place in warm and dry weather. After arriving in Mexico City early on Saturday morning, Buemi, despite being delayed by Gutiérrez, used 200 kW (270 hp) of power to go quickest in the first session with a lap of 1 minute, 2.222 seconds, half a second faster than Loïc Duval in second. Duval's Dragon teammate Jérôme d'Ambrosio, Vergne, Robin Frijns, Bird, Sarrazin, di Grassi, Daniel Abt and Evans rounded out the session's top ten drivers. The first practice session was held on a dusty track, causing Felix Rosenqvist, Frijns, López and Nelson Piquet Jr. to spin and Maro Engel temporarily stopped his car on track with a battery management system fault, necessitating a brief full course yellow flag. Frijns was investigated for performing a dangerous manoeuvre but no action was taken.
 In the second practice session, Buemi was the fastest driver with a lap time of 1 minute, 2.164 seconds; Di Grassi and Vergne were one-tenth of a second behind in second and third. Nick Heidfeld, Abt, Piquet, Engel, António Félix da Costa, Turvey and Duval occupied positions four to ten. During the session, where teams assessed their car's thermal management in preparation for the race, Bird and Piquet locked their tyres and went onto the turn one run-off area, while Abt stopped on the start/finish straight but was able to restart his car. Duval and Frijns spun within moments of each other. López lost control of his car at the final chicane, and later heavily damaged his vehicle's front-right corner in the final minutes by steering too early for turn 14 and collided with a barrier. The fastest 13 drivers were covered by under one second, indicating a highly-fought midfield battle.
 Saturday afternoon's qualifying session ran for 60 minutes and was divided into four groups of five cars. Each group was determined by a lottery system and was permitted six minutes of on-track activity. All drivers were limited to two timed laps with one at maximum power. The fastest five overall competitors in the four groups participated in a "Super Pole" session with one driver on the track at any time going out in reverse order from fifth to first. Each of the five drivers was limited to one timed lap and the starting order was determined by the competitor's fastest times (Super Pole from first to fifth, and group qualifying from sixth to twentieth) The driver and team who recorded the fastest time were awarded three points towards their respective championships. The session was held in dry and warm weather. Drivers complained of a lack of grip early in qualifying but lap times lowered when cars cleaned the circuit by driving on it.
 In the first group, Heidfeld led the session, almost one-tenth of a second faster than Bird in second, who in turn, was a further three-tenths of a second in front of Buemi in third who went wide at the first corner on his first timed lap despite being in clean air. Evans and di Grassi (who made a mistake in turn 17) were the group's slowest two drivers. Turvey was fastest in the second group and set the quickest overall group lap at 1 minute, 2.712 seconds, 0.053 seconds faster than Abt. López, Félix da Costa and Sarrazin were in third to fifth. In the third group, after the previous four drivers went onto the track, Duval was on his maximum power lap when he spun into the first corner and struck the barrier, causing the session to be stopped to allow his car to be removed from the circuit. After the session restarted with three minutes to go, Vergne led the third group, followed by Prost who lost half a second in the second half of the lap. Frijns, Piquet and Duval filled the next three positions.
 Engel was the quickest driver in the fourth group, and finished ahead of d'Ambrosio and Rosenqvist who struggled for decent pace. Gutiérrez and Adam Carroll were the fourth group's slowest two drivers. At the end of group qualifying, Abt, Engel, López, Turvey and Vergne qualified for super pole. Vergne was the first to record a super pole lap time; he was unable to achieve a rhythm and was fifth. Engel was slower in the track's first third of the lap, but went faster in the second part of the track by two-tenths of a second for third. López was quicker in the first two-thirds of the lap but was unable to go faster in the final third and took fourth. Abt was two-tenths of a second quicker than the previous three drivers in the first third of the lap. Although he lost a small amount of time in the next third, Abt took provisional pole position with a lap of 1 minute, 2.711 seconds. Turvey lost time while completing his lap and qualified second. The result would have given Abt his first pole position of the season, the second of his career, and his first since the 2015 Long Beach ePrix, but his car's tyre pressures were found to be below the mandated minimum pressure of 1.60-bar (160 kPa), demoting him to 18th. Further grid penalties were applied when Engel and his teammate Sarrazin dropped ten places because of gearbox changes. The application of Abt's penalty gave Turvey the first pole position of his career. After penalties, the rest of the field lined up as Bird, Félix da Costa, Buemi, Rosenqvist, Gutiérrez, Carroll, Evans, Engel, Prost,  Frijns, di Grassi, Piquet, Sarrazin, Abt, d'Ambrosio and Duval.
 A special feature of Formula E is the "Fan Boost" feature, an additional 100 kW (130 hp) of power to use in the driver's second car. The three drivers who were allowed to use the boost were determined by a fan vote. For the Mexico City race, Abt, di Grassi and Buemi were handed the extra power and the results of the vote were announced on the sixth lap. Weather conditions at the start were dry and sunny with the air temperature between 26.9 to 27.5 °C (80.4 to 81.5 °F) and the track temperature from 22.8 to 23.3 °C (73.0 to 73.9 °F); conditions were expected to remain consistent and no rain was forecast. When the race started at 16:00 Central Daylight Time (UTC–05:00) before 36,000 attendees, Turvey made a clean getaway to maintain the lead into the first corner with López close behind in second place. Vergne attempted to overtake López on the inside but Heidfeld turned right onto the outside and took third from him. A concertina effect occurred between turns three and five, which saw Sarrazin hit the back of di Grassi's car, damaging the latter's rear wing. Di Grassi was required to make a pit stop for a new rear wing.
 Duval and Abt gained two positions by the end of the first lap while Piquet lost three positions over the same distance. At the end of the first lap, Turvey led from López, who in turn, was followed by Heidfeld, Vergne, Bird, Félix da Costa, Rosenqvist, Buemi, Carroll and Evans. The stewards deployed the safety car on the second lap to allow marshals to clear debris in the chicane. Prost made a pit stop for a new nose cone while Sarrazin elected to switch into his second car. Di Grassi rejoined the race on the same lap as the leaders but at the back of the field. Turvey led at the lap-five restart, closely followed by López. Buemi immediately attacked Rosenqvist, passing him for sixth place and started to draw closer to Bird. López began to pressure Turvey for the lead with Heidfeld and Vergne close by. Jaguar teammates Evans and Carroll began battling for eighth while Gutiérrez lost tenth to both Andretti cars of Félix da Costa and Frijns. Abt gained further positions to be in 12th. At the entry to turn 13, Turvey had power issues with his car, and slowed on the start/finish straight, handing the lead to López. Turvey stopped at the turn one exit.
 Turvey's team asked him to reset his vehicle and a yellow flag was shown to warn drivers about his stranded car. After three laps, however, he was unable to restart his vehicle and retired, causing the safety car to be deployed for the second time. With the field closed up, di Grassi and d'Ambrosio opted to make the mandatory switch into their second cars on the 18th lap. Although the switch would allow di Grassi and d'Ambrosio to gain positions when other drivers made their stops, it required them to conserve electrical energy later on. The race restarted when the safety car entered the pit lane on the following lap with López remaining in first place, followed by Heidfeld, Vergne, Bird and Buemi. López built a small lead over the rest of the field and attention switched to Heidfeld who came under pressure from Vergne, Bird, Buemi and Rosenqvist. Although he had enough electrical energy to do another lap, Vergne made a pit stop to switch into a second car at the end of lap 24 to try and to drive without aerodynamic turbulence of airflow of other cars affecting him and undercut the field. The rest of the field followed one lap later. Swift work from López's team allowed him to remain narrowly ahead of Vergne, who in turn, passed Heidfeld. The Mahindra driver lost seven positions while Buemi moved from fifth to tenth, both as a result of slow pit stops. Prost led the field for one lap before making his stop on lap 26.
 Di Grassi took the lead with d'Ambrosio second; both drivers were half a lap ahead of the battling drivers, who had more available electrical energy. Félix da Costa and his teammate Frijns joined the leading group of drivers after being under the minimum pit stop time by three seconds. The safety was deployed for the third (and final) time when Duval retired with a battery issue leaving the chicane. This allowed the field to close up to di Grassi and d'Ambrosio. The safety car drove into the pit lane on lap 30 and di Grassi held the lead at the restart. Vergne immediately pushed hard and attempted to pass López for third but the two drivers made contact at the turn three chicane. He attempted the same manoeuvre one lap later but López cut the chicane to avoid hitting Vergne who radioed that López cede the position. Both Andretti cars were investigated because their pit stop times were faster the minimum permitted time of one minute because the team believed it was 57 seconds. López drew near to d'Ambrosio and Vergne remained close behind López, allowing di Grassi to pull away from the field.
 Félix da Costa retired on the 33rd lap due to a broken driveshaft. His teammate Frijns was issued with a drive-through penalty for being below the minimum pit stop time. Two laps later, López pushed hard and steered onto the outside line in an attempt to pass d'Ambrosio but slid onto turn one's run-off area braking for the first corner. Buemi activated FanBoost and lined up an overtake on Rosenqvist (who locked his front tyres) but spun braking for turn one, and narrowly avoided striking López's stranded car. Both drivers fell down the order. The electrical power in Engel's car depleted slowly after exiting turns five and six, curtailing his race. Buemi earned one point for recording the race's fastest lap of 1 minute, 3.102 seconds on lap 40. D'Ambrosio continued to hold back Vergne and the remaining seven cars behind him had more electrical energy available. D'Ambrosio locked his tyres under braking for the first corner, allowing Vergne to pass him for second place. Vergne then started to draw closer to di Grassi.
 Prost attacked Heidfeld but collided with the rear of his car at turn eight, sending him spinning into the path of his teammate Rosenqvist, who was unable to swerve to avoid him, and ploughed into his vehicle. It came after Rosenqvist was sent airborne following contact with Evans's rear wheel. Despite his vehicle's rear sustaining damage, Evans told his team over the radio that he could continue, as Rosenqvist retired. Prost however was delayed long enough to allow Evans move ahead of him for fifth place. Heidfeld was unhurt and rejoined the race. On lap 44, Bird passed D'Ambrosio on the outside for third at turn three. D'Ambrosio then ran out of electrical energy, promoting Gutiérrez to tenth. Di Grassi conserved his electrical energy and took his first win of the season and the fifth of his career. His victory ended e.Dams-Renault's streak of six consecutive wins, extending back to the 2016 Berlin ePrix. Vergne finished second, 1.966 seconds behind with Bird in third, Evans fourth and Prost fifth. López recovered from his lap 35 spin to secure sixth place, and Abt took seventh. Carroll, Piquet and Gutiérrez completed the top ten. Frijns, Heidfeld, Buemi and d'Ambrosio, Sarrazin and Rosenqvist were the final finishers.  Four drivers led the field and the lead changed three times during the course of the race. Di Grassi led once for a total of 19 laps, more than any other competitor.
 The top three drivers appeared on the podium to collect their trophies and spoke to the media in a later press conference. When asked about how he performed his comeback, di Grassi said he did not know but praised his mechanics for their work. He stated that the race demonstrated that Formula E could switch to "Heaven to Hell in one go", and said he felt if the third safety car period had not intervened, he could have managed his advantage over Vergne. He also revealed on three occasions during the race, he believed that the possibility of him winning was nonexistent. Vergne had mixed emotions, spoke of his feeling the victory was in his grasp but was happy to finish on the podium and was in contention for the championship: "We started very far away but I know I'm in the right team with the right car to win the championship. I think we're coming back a little bit better and we're getting stronger every race as a team." Third-place finisher Bird said that it was "a good race" for everyone who watched the event on television and the series. He stated the action observed in the race was positive for the series. Bird also said he was happy with his pass on d'Ambrosio.
 Vergne was angry with d'Ambrosio's defensive driving and found the manner d'Ambrosio drove not "acceptable and fair". He described d'Ambrosio's tactics as "totally stupid" and prevented him from winning and questioned his intelligence. Vergne revealed d'Ambrosio wanted to discuss the manoeuvres but Vergne did not want that. D'Ambrosio argued his driving was fair, saying he was doing his own race. He argued if the sport's governing body, the Fédération Internationale de l'Automobile, felt he was overly aggressive, he would be notified and issued a warning. D'Ambrosio said that from his point of view, he steered into the corner early and argued he did not change his line: "Sure, I didn't give much space but this is racing. I understand it can be frustrating but everyone is doing their own race and it's what the fans want to see." He felt he could have achieved a maximum finishing position of fifth but the energy targets displayed on his steering wheel dashboard did not match those provided to him by Dragon, which caused him to push hard until his team realised they were mistaken. Vergne changed his verdict on the clash weeks later after admitting he was not aware that d'Ambrosio had incorrect information relayed to him. "Things like this can happen. I don't think there are any more worries about it", he said.
 The stewards elected not to take any action over the incident between Prost and Heidfeld. Heidfeld spoke of his belief the origins of the accident came from both Andretti cars being released under the minimum pit stop time, saying he drove onto the pit lane alongside Félix da Costa and ceded the position to the Andretti driver. He additionally stated that Bird was also involved and remained ahead of him. Prost was resolute that the contact was avoidable had he been given enough space by Heidfeld. He was confident the stewards would agree with his point of view. "I was on the kerb and he did not leave me any room at all when I was at his side", he said. Evans thought after he was hit by Rosenqvist, he would not be able to finish the race and felt his Jaguar would not survive such a collision in a similar scenario. Nevertheless, he was delighted to score his first points in Formula E, saying: "Those first points are always the hardest. We know we've not got the best package but we're making great progress and everyone should be really proud." Jaguar team principal James Barclay said the crash was the moment when "our hearts sunk" and felt there was no possibility of finishing the race but praised the strength of Evans' Jaguar.
 The result kept Buemi in the lead of the Drivers' Championship on 76 points, but his advantage over di Grassi was reduced from 29 points to five. Prost remained in third position on 46 points while Vergne's second-place finish put him within six points of the latter. Bird's third-place result saw him pass Rosenqvist for fifth. Audi Sport ABT's result reduced the gap to Teams' Championship leaders e.Dams-Renault to 31 points. Virgin and Techeetah (on 43 and 41 points respectively) moved ahead of Mahindra with eight rounds left in the season.
 Drivers who scored championship points are denoted in bold.