PARIS—Emmanuel Macron’s government said Thursday it would temporarily nationalize the STX France shipyard to stop Italian company Fincantieri SpA taking majority control, a dirigiste move that sparked tensions between Paris and Rome.

The French government said it would use its pre-emption rights to take 100% control of the shipyard at Saint-Nazaire on France’s Atlantic coast, just days before Italian state-controlled Fincantieri was due to take a 66.7% stake from South Korea’s STX Offshore and Shipbuilding. The French state...