This is a very broad, complicated question. Short answer, through rapid modernization and aggressive military action against less-rapidly modernizing neighbors. Long answer, there's a LOT on this in the Japan section of the FAQ. Directing you there is a great deal simpler than trying to type out more than eight decades of complicated history.
Well... that's a simple question. I don't know much about the subject, but I can say a bit about the early stages of the process.
In the year 1868 the Meiji Restoration put an end to over 250 years of shogunal rule and established a government around the figure of the Emperor, causing a huge nation-wide reform that reached every aspect of the country's rule. The goal of the new government was to modernize Japan so it would be considered in the same level as the other colonial powers of the time, such as Great Britain, the US, etc. The unequal treaties that granted foreigners in Japan extraterritoriality were considered insulting, and there was a feeling amongst the elites that they steamed from the "uncivilized" Japanese legal system. This it was thoroughly revised, taking European models into account. A sense of nationalism was instilled in Japanese people, and the borders of the country were clearly defined for the first time in history. Japan was until this point mostly confined to Honshu, the main island of the archipelago, but now Tokyo pressed to establish the border as far north as possible in Hokkaido, causing some tension with Russia. It is decided in 1874 that Japan will keep the Kuril Islands and let go their claim of the Sakhalin. The Ryukyu Islands in the south (Okinawa), which have had an ambiguous status as tributary of the old province of Satsuma are integrated under the jurisdiction of the new prefecture of Kagoshima in 1871.
In that same year, however, some shipwreck Ryukyu fishermen are murdered by Taiwanese Aboriginals, and the public opinion and internal pressures in Japan end up with the government sending a punitive expedition to the island. The attack does not actually take place until 1874, though. Of course, China was not very happy about this development, but it was finally agreed that the expedition was caused by Japan's rightful intention of protecting the safety of its citizens, which was a terrible blow to China's prestige in the area.
At the same time, there were movements in Japan for a greater influence in Korea, since it was considered that the two countries had a historical bond that had been dominated by China. The justification was that Japan, as the modernizing and civilizing force in Asia, had to take the place the Chinese had once hold. The discussion about the way in which the Korean problem should be faced, if using diplomacy or military power, was long and vicious, and was a constant headache for the government throughout the 70s. An embassy was dispatched in 1876... But also some gunboats.
Fast-forward to the 1890s. Most Asia and the Pacific is colonized except for China, Korea, and Japan, and the Japanese are eager to show they too are a civilized country; that is, a colonial power. During the 1880s and 1895 Japan starts establishing colonial enclaves in the other two nations. During the 70s and the 80s Japan extended its economic and political control over Korea, exporting goods, opening offices for their companies, and buying over 90% of Korea's exports. They also send military advisers to the Korean army. When Korean insurgents killed some of this advisers in a coup against the Chinese and Japanese forces in the country, Japan stationed troops in Seoul, and started preparing for a possible war against China for the control of the Korean peninsula. In the country, there was a very strong patriotic current and talk for the creation of a "Greater Asia" was everywhere. It was their duty to "save" China and Korea. In 1894, The Japanese introduced troops in Korea taking the chance of a rebellion that put the King's court against the ropes, in clear opposition to an 1885 Japanese-Chinese agreement. This lead to a war that would last for a year. A relatively easy victory put Korea in the hands of Japan, which saw it as an indication to go on expanding their influence through the area.
As sofabearsdontknow says, it's kind of a long story. And there's way more.
Source: Akira Iriye, "Japan's Drive to Great Power Status" in Cambridge History of Japan vol. 5, 1989.
Edit: Sourced the source.