Mohammed Khalaf was arrested "as he was smuggling a large amount of narcotic pills into the kingdom," the ministry said in a statement published by the official SPA news agency.
He was beheaded by the sword in the northern Jawf province.
His beheading brings to 36 the number of people executed in Saudi Arabia since the beginning of the year, according to an AFP tally.
In 2012, the kingdom executed 76 people, according to an AFP tally based on official figures. Human Rights Watch put the number at 69.