British retailer Marks & Spencer posted its first rise in annual profit in four years and said it would return excess cash to shareholders, fuelling hopes that it has finally rediscovered a successful formula.

Britain's biggest clothing retailer, which also sells homewares and upmarket food, said on Wednesday it made a profit before tax and one-off items of 661.2 million pounds ($1.02 billion) in the year to March 28.

That compares with analyst forecasts of 625-664 million pounds, with a consensus of 648 million pounds, and is 6.1 percent higher than the 623 million pounds made in 2013-14.

M&S raised its dividend 5.9 percent to 18 pence and announced the start of an ongoing programme of enhanced returns for shareholders with a share buyback of 150 million pounds for the 2015-16 year.

"We are a more capable business following a sustained period of investment in our infrastructure and in our people," said Chairman Robert Swannell.

Shares in M&S, one of Britain's best known high street shopping chains, have risen by a third over the last nine months, hitting an eight-year high on Tuesday.

The increase reflects hopes that the billions of pounds spent by Chief Executive Marc Bolland on the redesign of products, stores, supply chain logistics and its website is paying off and addressing decades of under-investment in the 131-year-old firm.

Bolland, in the job since 2010, has focused on boosting profit margins. He delivered a rise in the 2014-15 gross margin for general merchandise -- spanning clothing, footwear and homewares -- of 190 basis points.

That was a reward for having sourced more goods directly from suppliers, spending less on promotions and concentrating more on full-price sales.

The food gross margin rose 30 basis points.

M&S said it expected further progress in the 2015-16 year, guiding to gross margin growth of 150-200 basis points in general merchandise and up to 10 basis points in food.