Telefonica Agrees to Buy British Mobile Phone Company Telefonica of Spain agreed to buy the British mobile phone company O2 for $ 31.5 billion in a deal that could spur greater competition in Europe 's more established markets .