* St1 to pay $640 mln cash for refinery, 565 gas stations
* Sale price includes oil inventories
* Latest in string of refining, retail sales by Shell
(Adds analyst comment, background)
HELSINKI, Oct 27 (Reuters) - Royal Dutch Shell (RDSa.L) has agreed to sell its Finnish and Swedish operations, including a refinery in Gothenburg, to Finnish firm St1 for $640 million, as the oil major continues to cut back its downstream activities. The deal includes an 87,000 barrels of crude oil per day refinery, 565 filling stations and Shell's bulk fuel business in the two countries, and a marine business in Sweden, the firms said on Wednesday.
Helsinki-based, privately held St1 produces biofuel and runs petrol stations across Scandinavia as well as in Poland, some of them purchased from Statoil (STL.OL) and ExxonMobil (XOM.N).
All major international oil companies are focusing on their upstream oil and gas production units and selling refineries and forecourts, especially in Europe where fuel demand is dropping, hitting margins.
"In our view the reduction in exposure to European refining is positive for the stock, as margins remain depressed due to overcapacity and high inventories," analysts at Bernstein said in a research note.
Analysts said Shell had achieved a good price, given the large number of refineries on the market in Europe.
However, it was unclear whether the analysts had factored in that the published price included the value of inventories at the site. Companies such as Shell usually strip out the value of inventories from announced deal prices.
"The thing that makes the deal price high is oil. There is a lot of oil. Oil is expensive .... but it can be turned into cash quickly with one phone call," St1 board chairman Mika Anttonen told Reuters.
He declined to comment how the deal would be financed.
Shell said last year it planned to divest about 15 percent of its refining assets in developed countries, where industry executives say demand has peaked.
The Gothenburg refinery supplies the domestic market with fuels that traders say are niche products, such as diesel that does not freeze in extremely cold Nordic weather. (Reporting by Tarmo Virki and Terhi Kinnunen in Helsinki and Tom Bergin in London; Editing by David Hulmes)