Both victims are from the hardest-hit town of Mashiki, about 15 kilometres east of Kumamoto city on the island of Kyushu, said Kumamoto prefecture disaster management official Takayuki Matsushita.
Earlier, Japanese Red Cross Kumamoto Hospital said it had admitted or treated 45 people, including five with serious injuries.
The quake struck at 9:26 PM at a depth of 11 kilometres near Kumamoto city on the island of Kyushu, the Japan Meteorological Agency said. There was no tsunami risk.
Japan's Chief Cabinet Secretary Yoshihide Suga said at least 19 houses collapsed, and hundreds of calls came in reporting building damage and people buried under debris or trapped inside.
More From This Section
"Because of the night darkness, the extent of damage is still unclear," he said.
The damage and calls for help are concentrated in the town of Mashiki, about 1,300 kilometres southwest of Tokyo, Japan's Fire and Disaster Management Agency said
One of the victims in Mashiki died after being pulled from some rubble, and the other was killed in a fire, Matsushita said. A third person rescued from under a collapsed building is in a state of heart and lung failure.
"There was a ka-boom and the whole house shook violently sideways," Takahiko Morita, a Mashiki resident said in a telephone interview with Japanese broadcaster NHK. "Furniture and bookshelves fell down, and books were all over the floor."
Morita said some houses and walls collapsed in his neighborhood, and water supply had been cut off.
Dozens of people evacuated their homes and gathered outside Mashiki town hall, sitting on tarps well after midnight. Some wrapped blankets around their shoulders against the springtime chill.
Prime Minister Shinzo Abe told reporters that the government has mobilized police, firefighters and self-defense troops for the rescue operation.
There were multiple aftershocks, the largest one with a preliminary magnitude of 6.4 shortly after midnight, according to the Japan Meteorological Agency.