A group of 15 EU member states have agreed to take in 40,000 Afghans for resettlement, Commissioner Ylva Johansson said on Thursday after meeting interior ministers.
Germany will accept 25,000 of the new arrivals, the Netherlands 3,159, Spain and France 2,500, and other countries lower numbers, AFP reported a document as saying.
"And I think this is an impressive act of solidarity," Ms Johansson said.
She said that allowing more Afghans to migrate in a controlled way would help to prevent "irregular arrivals".
The UN High Commissioner for Refugees had urged the bloc to accept 42,500 Afghans over five years, but some of the 27 member countries had resisted.
There are an estimated 85,000 Afghans who have fled their homeland into countries nearer the EU, and the Taliban's seizure of Kabul coupled with a drought could trigger new flows.
After the chaotic US military withdrawal and the return of the Taliban regime in August, 24 EU states have already taken in 28,000 Afghans.
But UNHCR chief Filippo Grandi said 85,000 Afghans who were living in vulnerable situations outside the bloc needed resettlement, and he urged Europe to take half.
Ms Johannson had previously described this goal as "do-able" but she still had to persuade member state, only confirming the figure after the meeting on Thursday.
The 40,000 Afghans are part of a larger 60,000 package of resettlements and humanitarian admissions pledged by member states.
France and Sweden made bigger pledges of 5,000 and 4,200 resettlements, but these will not necessarily be Afghans alone. Belgium promised places for 425 Afghans and 1,250 others.