The gunman took his own life in Monday's incident in Bangkok, Charin Gopatta, Deputy Commissioner of the Metropolitan Police Bureau, told Reuters.
"Police are investigating the identity of the person and the motive for the incident," Thai police said in a statement.
The five people killed by the gunman were security guards at the market, it said.
No tourists were killed or injured in the shooting incident, said Sanong Saengmani, a police official in Bangkok's Bang Sue district, where the market that mainly sells agricultural produce is located.
Tourism is a key economic driver in Thailand, Southeast Asia's second-largest economy, where growth has been sluggish and such incidents can potentially dampen sentiment.
In video shared by police, a suspect in a white hat and a backpack slung on his chest is seen walking through a car park at the market.
Gun violence and gun ownership are not uncommon in Thailand.
In October 2023, a 14-year-old suspect used a modified handgun to kill two people and injure five others at a luxury mall in central Bangkok.
A year earlier, a former police officer killed 36 people, including 22 children, in a gun-and-knife attack at a nursery in eastern Thailand.
Lifeline 13 11 14
beyondblue 1300 22 4636