Libyan pro-government forces
Members of the Libyan pro-government forces, backed by the locals, with weapons are seen during clashes in the streets with Shura Council of Libyan Revolutionaries, an alliance of former anti-Gaddafi rebels who have joined forces with Islamist group Ansar al-Sharia, in Benghazi April 1, 2015. Picture taken April 1. REUTERS/Stringer

(Reuters) - A bomb exploded in front of the Spanish embassy in the Libyan capital late on Monday, residents said, the latest in a string of attacks on foreign missions in the North African country.

"We heard a loud explosion," said a Tripoli resident living next to the embassy.

Spain's El Mundo newspaper said nobody had been hurt as Spain, like most Western and Arab countries, had pulled out its diplomats in summer during weeks of heavy fighting between rival armed groups in Tripoli.

Pictures posted on social media showed some damage at the building's wall. There was no immediate claim for the attack or comments from Tripoli officials.

Militants loyal to Islamic State have claimed a string of killings of foreigners as well as attacks on embassies and oilfields in Libya.

Islamic State militants have exploited chaos in the North African country where two governments allied to a host of armed groups are fighting for control four years after the ousting of Muammar Gaddafi.

On Sunday, the group claimed the killing of around 30 Ethiopan Christians, two months after the beheading of 21 Egyptian Copts on a Libyan beach.

Libya's internationally recognized government has been based in the east since a rival faction called Libya Dawn seized Tripoli in August, setting up a rival administration.