Officer Jorge Garcia Tudela died at dawn from wounds sustained during the siege in the Afghan capital's diplomatic quarter late on Friday, the ministry said in a statement.
News of the Tudela's death comes after Spanish Prime Minister Mariano Rajoy confirmed late on Friday that a first policeman had been killed in the attack. He was named as Isidro Gabino Sanmartín Hernández by Spanish media.
The officers were killed during an an hours-long Taliban siege near the Spanish embassy in Kabul's diplomatic quarter, the latest high-profile insurgent attack that ended early on Saturday.
During the siege, security men near the embassy ducked from gunshots as they hauled away a limp body and two wounded men — one bleeding from the head, the other a policeman with a gunshot wound to his leg — through the dark to a waiting ambulance, a photographer with the AFP news agency saw.
The embassy had been earlier reported to be the target of the attack, but Rajoy clarified that the assault was nearby and not on the compound.
Mi solidaridad con todos los españoles que han trabajado y trabajan en Afganistán. A todos ellos, nuestro cariño y afecto #Kabul
— Mariano Rajoy Brey (@marianorajoy) December 11, 2015
“It was an attack against some guesthouses very near the embassy,” the Spanish prime minister said, confirming all embassy staff had been evacuated.
The Taliban claimed responsibility for the attack, saying the target was a foreign guest house.
Afghan special forces had cordoned off the area in Sherpur district in central Kabul, where a huge car bomb struck during rush hour on Friday evening, followed by bursts of gunfire.
Ambulances and fire brigades with wailing sirens were seen rushing to the area.
Sherpur is home to several foreign NGOs and the residences of senior government officials, including former warlord Abdul Rashid Dostum, Afghanistan's first vice-president.
Friday's assault follows a deadly Taliban siege of Kandahar airport this week as the militants ramp up attacks despite the onset of the harsh winter season, when the fighting usually winds down.
It also comes after Afghan President Ashraf Ghani's high-profile visit to Pakistan, where he shored up international support to restart peace talks with the Taliban.