Japan has warned people to avoid Mount Asama after the eruption (AFP)

A volcano near Tokyo has erupted for the first time in four years, throwing ash and smoke nearly two kilometres into the sky and sparking warnings not to approach the mountain.

Mount Asama, some 140 kilometres (90 miles) northwest of the Japanese capital, exploded overnight and prompted the national meteorological agency to raise its alert level to three out of five, meaning people should avoid the crater.

The agency warned that large rocks and fast-moving flows of hot gas could affect a radius of four kilometres from the crater and that nearby towns could be hit by smaller rocks and ash depending on prevailing winds.

An agency official told AFP on Thursday that gas was still being thrown into the air but at a "normal" level. "We don't see activity picking up," he said.

Mount Asama last erupted in June 2015. There were no injuries in the small eruption.