A Thai court has sentenced a man to death after convicting him of raping a 13-year-old girl on an overnight train, killing her and then throwing her body out the window.

The brutal murder committed by a train employee in July sparked an uproar in Thailand and prompted calls for the execution of rapists.

The Hua Hin provincial court on Tuesday convicted Wanchai Saengkhao of murder, raping a minor and other charges.

The 22-year-old confessed to drinking beer and taking drugs during his shift before raping and killing the girl, who was traveling with her sisters to Bangkok.

The girl's body was found near train tracks in western Thailand three days after her murder. The incident prompted the national rail authority to introduce women's-only carriages on main routes nationwide.