BP's shares jumped more than 5% this morning as British investors welcomed last night's capping of the well which has been spewing oil into the Gulf of Mexico since April.

The company said last night that its latest attempt to staunch the gushing well had worked and that for the first time in 87 days oil was no longer gushing from a mile-deep well off the Louisiana coast – raising hopes that it could be sealed for good. This sent BP's shares straight to the top of the FTSE 100 risers when trading began this morning, up 22p at 423.75p, slipping back to close up 5.4p at 407.15p.

President Barack Obama also gave the news a cautious welcome, saying: "I think it is a positive sign, [but] we're still in the testing phase." He is expected to make a fuller statement later today.

The flow of oil was cut off yesterday evening as engineers began shutting off a series of valves around the well, a process that took about two hours. The company told the City this morning that it will monitor the cap holding back the oil in a series of pressure tests every six hours for the next 48 hours, before it can be certain the well would hold. It also cautioned that the final solution remained a relief well, still some weeks away.

The company's woes have presented Britain's pension funds – which rely on BP's dividend income to provide £1 in every £7 they receive each year – with a major problem. The company has had to suspend shareholder payouts and set aside $20bn (£13bn) to pay for the clean-up operation and compensation claims relating to the explosion on the Deepwater Horizon rig on 20 April which killed 11 workers. Stopping the leak should help to cap BP's potentially huge liabilities.

The huge environmental cost of the spill, as well as a series of PR gaffes by BP boss Tony Hayward, has put the British oil major on a collision course with the US government, with Obama one of its fiercest critics.

The British company is also under fire by US politicians over its dealings with Libya and will face scrutiny at a US Senate foreign relations committee hearing on 29 July. The committee said BP executives would be asked to testify, after it admitted to having lobbied the British government in 2007 to agree to transfer Abdelbaset al-Megrahi – the Libyan intelligence officer convicted of the 1988 bombing of an airliner over Lockerbie – to Tripoli. The committee's chairman John Kerry, who had opposed Megrahi's release, said: "Details that have emerged in recent days in the press have raised new concerns."