Spanish telecoms giant Telefonica agreed on Monday to buy mobile group O2 Plc for 17.7 billion pounds ($31.6 billion), sparking hopes of a bidding battle for one of the sector's hottest takeover targets, Reuters reported. Financially-powerful Telefonica, the world's fifth-largest telecoms firm by market value, said it would pay 200 pence per share in cash -- a 22 percent premium to O2's closing share price on Friday -- sending the UK-based company's shares surging 24 percent to 203-1/4 pence by 1017 GMT. A successful 02 bid, the second-largest telecoms offer in Europe since the end of 2000, would allow Telefonica to break into the fiercely-competitive UK market and re-enter Germany, which it abandoned in 2002 after failing to build a greenfield mobile operation there. "O2's integration in the Telefonica group will enhance our growth profile, it will allow us to gain economies of scale, it will open the group to two of the largest European markets with a sizeable critical mass and it will balance our exposure across business and regions," said Telefonica Chairman Cesar Alierta. A source close to talks said Telefonica had approached O2 last week and was given access to the company's books over the weekend. "There was an approach and a series of negotiations and it got done very quickly," the source said. O2, Europe's sixth-largest mobile phone company which owns assets in Britain, Ireland and Germany, is one of the few independent pure mobile phone operators and has long been tipped as a likely target to help trigger a new telecoms gold rush. European telecoms behmoths have spent the last three years funnelling their sizeable cashflows into paying down debt. But even after starting to return cash to shareholders again with dividends and share buy-backs, analysts have said they have plenty of room on their balance sheets for major acquisitions. --more 1325 Local Time 1025 GMT