Japan.
This happened in Japan following what is known as the Meiji Restoration. In 1868, shogun rule was ended and the emperor was restored to full power over the country. The new emperor took the name "Meiji" meaning "enlightened rule." It was under the reign of Emperor Meiji, which lasted till 1912, that Japan did much modernizing and westernizing.