MADRID (Reuters) - Spain on Friday signalled it was open to a potential takeover bid of energy firm Naturgy by Abu Dhabi's TAQA, saying that while the government will defend its strategic interests that did not imply it would block the deal.

TAQA confirmed on Wednesday it is in discussions with the three largest shareholders of Naturgy about a possible bid for the largest natural gas firm in Spain.

Given Naturgy's strategic role in the country's energy system, the government by law must have a say on such a deal.

"I have spoken of the need to be vigilant and guarantee energy security in defence of Spain's strategic interests," Energy Minister Teresa Ribera said when asked about the potential deal at a press conference. "This does not mean vetoing any company or investor."

Spain has already shown it has the mechanisms at hand to protect its interests when it approved Australian fund IFM's partial takeover bid for Naturgy in 2021, Ribera said. The government imposed conditions to protect jobs, investment and the supply of gas and electricity.

"The control mechanisms or vigilant mechanisms for investments from third countries were activated and some conditions were introduced, and I believe that it has worked correctly," she said.

Last year, Spain faced a similar decision after Saudi Arabia's STC bought a 9.9% stake in telecoms operator Telefonica. In December the government said it would buy a stake of up to 10% in Telefonica as a counterbalance.

Ribera said that the government "will be keeping a close eye on how these talks (over Naturgy) develop and, where appropriate, on the characteristics of the conditions under which a non-EU investor can become part of the company's assets."

Naturgy has a stake in a key gas pipeline between Spain and Algeria. It also has a long-term contract to import some 3 billion cubic metres (bcm) of Russian liquefied natural gas each year.

(Reporting by Pietro Lombardi; Additional reporting by Emma Pinedo; editing by Charlie Devereux and Elaine Hardcastle)