Shōgun was the title of leading samurai. While the Japanese emperor (Tennō) officially ruled Japan, the Shōgun held the military power.
Officially a Shōgun was appointed by the emperor but in reality the Shōgun ruled Japan. The title was hereditary and the Shōgun could be seen as dictator.
The goverement of a Shōgun was called Bakufu.