TRIPOLI (Reuters) - Militants loyal to Islamic State claimed an attack at a checkpoint in a suburb of the Libyan capital on Sunday, according to a statement on social media, days after a similar attack on a police station.

A bag of explosives went off at a checkpoint next to a Janzour security directorate building, west of Tripoli, wounding five policemen, said Essam Nas, a local security spokesman. One of the wounded policemen is in a serious condition, he said.

Islamic State militants published on social media a picture of a security directorate building next to the checkpoint which they said was the location of an explosion.

Militants loyal to Islamic State, the group that controls much of Syria and Iraq, have been exploiting the chaos in Libya where two governments allied to armed factions are vying for power four years after the overthrow of Muammar Gaddafi.

Groups of Islamist militants, who have declared loyalty to Islamic State over the past six months, have claimed responsibility for several high-profile attacks in what appears to be an intensifying campaign.

They claimed responsibility for an attack on the Corinthia luxury hotel in Tripoli in January, which killed five foreigners and at least four Libyans, as well as a group of Egyptian Copts in the central city of Sirte, triggering air strikes by Egypt.

The site of Sunday's explosion is close to the Palm City compound, which used to be a favorite place of accommodation for diplomats and expatriates until last summer when most left due to the deteriorating security situation.