Japan's electricity grid creaked Thursday under the strain of Tokyo's hottest June since records began, but a power shortage was narrowly averted as supply improved in the evening and authorities lifted a power crunch alert.

Temperatures of around 40 degrees Celsius were recorded in some parts of the Kanto region on the sixth day of a heat wave that began after the earliest end to the capital's rainy season in decades.

In Tokyo, the temperature climbed to 36.4 C, the highest for June in records available since 1875, according to the weather agency.