Ursula von der Leyen will now replace Jean-Claude Juncker as head of the EU executive on November 1, one day after Britain is due to leave the union, and serve a five-year term as head of the bloc's executive.
Ursula von der Leyen (left) talks to German Chancellor Angela Merkel during the weekly cabinet meeting on July 17. Von der Leyen will step down as minister to become the first woman to hold the EU's top job. AFP photo
German defence minister Ursula von der Leyen was narrowly elected president of the European Commission on Tuesday after winning over sceptical lawmakers.
The 60-year-old conservative was nominated to become the first woman to hold Brussels' top job last month by the leaders of the bloc's 28 member states, but to the annoyance of MEPs.
The European Parliament would have preferred a candidate chosen by one of its political groups, but in the end 383 members of the 751-member assembly voted for her.
She will now replace Jean-Claude Juncker as head of the EU executive on November 1, one day after Britain is due to leave the union, and serve a five-year term as head of the bloc's executive.
"The task ahead of us humbles me. It's a big responsibility and my work starts now," the polyglot mother-of-seven told lawmakers, thanking all members "who decided to vote for me today."
"My message to all of you is let us work together constructively, because the endeavour is a united and strong Europe," she said, urging capitals to nominate an equal number of men and women to her commission.
If von der Leyen had lost, Brussels faced a summer of infighting instead of preparing for Brexit, battling Italy over its debt and confronting Hungary and Poland over their alleged threats to European law and values.
Instead, she won, but only narrowly.
And Poland's governing PiS party -- which is facing EU action over rule of law issues and is reluctant to adopt rapid cuts in carbon emissions -- was quick to remind her that her majority relied on their support.
In Brussels, officials privately admitted that the numbers were weaker than hoped, but said they had pushed on with the vote to seal the deal before the nominee was forced to make more concessions.
A majority is a majority
At a news conference after the vote, von der Leyen played down the narrowness of her win, noting that a "majority is a majority" and acknowledging that some had opposed the nomination process.
"Two weeks ago I didn't have a majority because no one knew me. There was a lot of resentment because I wasn't a lead candidate," she admitted, adding that she was happy to have built a majority so quickly.
"It's a good base to start with," she said. The veteran minister will head briefly to Berlin on Wednesday to say farewell to her government and the German armed forces, then return to work on building an administration.
In Berlin, Chancellor Angela Merkel praised her long-time ally as a "committed and convincing European" who would "tackle with great vigour the challenges facing us as the European Union".
President Emmanuel Macron tweeted that France would be by von der Leyen's side: "Today, Europe bears your face. The face of engagement, ambition and progress."
The president of the European Council of EU leaders, Donald Tusk, also congratulated her, declaring her, "a passionate fighter for Europe's unity."
From the left, Spanish Prime Minister Pedro Sanchez also offered his congratulations, but said von der Leyen must push for "a more social, fair, sustainable and feminist Europe."
Von der Leyen has had only a short time since the 28 EU leaders nominated her to win over the main centre-right EPP, socialist S&D and liberal Renew Europe blocs she hoped would get her the necessary 374 votes.
In the hours between her speech and the start of voting, party officials suggested she could count on the centre-right, almost all of the liberals and maybe two-thirds of the left.
The election was by secret ballot, but the tight margin suggested that many MEPs from both her own conservatives and the rival socialist group abstained or opposed her.
Top jobs package
Juncker received 422 votes five years ago, and Brussels-born von der Leyen's 383 was seen as disappointing in comparison, given her backing from the 28 EU leaders.
Von der Leyen's nomination was part of a package of so-called "top jobs" and outgoing Belgian premier Charles Michel is still in line to head the European Council of EU leaders.
IMF director Christine Lagarde's appointment to the European Central Bank also remains on course, and on Tuesday the French former finance minister announced her resignation from the global body.
In addition to Brexit and the other issues facing the EU, member states are also wrangling over new rules for distributing migrants and refugees after Italy's populist government began to prevent rescue boats from landing.
For that, the commission president will need a reliable majority in Strasbourg, after this year's elections threw up a more fragmented EU parliament than ever before.
Von der Leyen will be replaced as German defence minister by Annegret Kramp-Karrenbauer, Chancellor Angela Merkel's favoured successor and the head of her CDU party, the country's upper house announced late Tuesday.