BEIJING, June 23 (Reuters) - Beijing on Friday upgraded its warning for hot weather to "red" - the highest in a colour-coded alert system - saying most parts of the Chinese capital could roast in temperatures of up to 40 degrees Celsius (104 Fahrenheit).

On Thursday, the maximum temperature in the city of nearly 22 million people breached 41C and shattered the record for the hottest day in June.

A weather station in its southern suburbs, considered to be Beijing's main gauge, recorded 41.1C in the afternoon. The previous June high was logged on June 10, 1961, when the mercury hit 40.6C.

The daily maximum logged on Thursday was the city's second-highest in history, just below the 41.9C recorded by Beijing on July 24, 1999.

China has a four-tier weather warning system, with red the most severe, followed by orange, yellow and blue.