Troops in Iraq have claimed victory over Islamic State militants in a key oil hub in the country’s north, but a deadly suicide bombing targeting government forces and continued clashes with the extremists have underscored the fragility of such gains.

Iraqi police and soldiers backed by pro-government militias entered Baiji on Tuesday, officials said, for the first time since the Islamic State seized the industrial city as part of its lightning offensive across northern Iraq in June. Security forces recaptured three buildings in central Baiji, including the local council and police headquarters as well as a mosque, officials said.

Security officials said the takeover marked the beginning of a wider operation to also break the militants’ months-long siege of a nearby oil refinery — the country’s largest. Baiji is about 140 miles by road north of Baghdad. […]