The man who ended Ashikaga rule was Oda Nobunaga. In 1568 he took Kyoto (and therefore the Emperor) and destroyed the last Ashikaga shogun a few years later. Before Nobunaga could finish his conquest of the country and be named shogun, a treacherous general assassinated him (in 1582).
Hideyoshi stepped forward to revenge his lord. Hideyoshi soon finished conquering, subduing and / or making allies of the remaining lords. Japan had a strong centralized government for the first time in close to two hundred years. Hideyoshi then set about consolidating his power over both the daimyo and the ordinary people. In 1588, Hideyoshi commanded all commoners to turn in their weapons because he was planning to build a really, really big statue of the Buddha (we are talking bigger than the Statue of Liberty). Obviously turning over your sword so that it could be melted down to provide metal for a religious statue must be a very good thing to do, right? Maybe, if you're an idiot. Hideyoshi didn't care about building a statue, he just wanted to disarm the peasants (kind of hard to rebel without weapons, isn't it?). Around the same time, Hideyoshi also decreed that from then on, no one could change status. A boy born to a peasant was a peasant and could never change his status. Thus, a man who owed his position not to birth but to luck, skill, and achievement was forever forbidding anyone else from ever doing it again. Just to be absolutely sure about the people (and thus his tax income), Hideyoshi also carried out a nationwide land survey.
In foreign affairs, Hideyoshi showed less intelligence. In 1592, he invaded Korea with the intention of going all the way to Beijing. If this seems to border on the megalomaniac, keep in mind that Japan was brimming over with veteran troops who, after unification, suddenly had no more wars to fight. Hideyoshi sure didn't want them all hanging around making trouble in Japan. So why not ship them off to fight somewhere else? (I should point out that this sort of thing was also a factor in the Spanish conquests in the Americas.) Still, even considering the danger of restless samurai at home, there was a bit of insanity in the idea of Japanese samurai conquering all of East Asia; when Hideyoshi died in 1598, the invasion was abandoned and Japan peace made with her neighbors. (They never had a chance anyway, not after the Ming Dynasty in China sent troops to help the Koreans.)
We need to backtrack just a little bit for a moment to touch on some events which had monumental results for the direction of Japanese history. In 1543 a Chinese cargo ship arrived in Tanegashima harbor (a little south of Kyushu) with about a hundred men aboard. This was not at all an unusual occurrence. The three Portuguese adventurers on board the ship, however, were very unusual - they are the first Europeans known to have visited Japan. Almost as important, the Portuguese men brought their guns with them. Within a few weeks, the lord of Tanegashima bought two of their guns for a whole lot of gold and gave them to his chief sword smith to study the weapons and make more. Soon orders were coming in from all over Japan as the more flexible daimyo sought to exploit the new weapon's power on the battlefield. After some initial adjustment to the new strategies required for musket warfare, the daimyo were using guns successfully in their battles. Also, after making some improvements to the European model, some daimyo profited from the selling of arms to the rest of Asia.
Europeans brought more than just firearms. Hot on the heels of the original three Portuguese came merchants and missionaries. The Japanese immediately labeled them barbarians, but this shouldn't be too great a surprise. Uneducated, unwashed, and rude is probably a fair description of the majority of early visitors to Japan. After all, these men were not diplomats and only a few were missionaries. Most were sailors or adventurers arriving in tiny ships after months at sea. Not the kind of guys you take home to meet the folks. However, as already mentioned, a few missionaries did go to Japan, the most famous being Fr. Francis Xavier of the Jesuits. This was the first face to face meeting between Japan and Christianity. It says something about the quality of the missionaries that they made quite a few converts (considering that the religion they were preaching was totally alien to everything in Japanese culture). At first Christianity suffered from few overt barriers, but after Spain took the Philippines, some fool Spanish man bragged that missionaries were always sent in first to soften up the enemy and that Japan would be next. Obviously, this didn't sit well with the guys in power in Japan and they issued several edicts against the missionaries, finally just expelling them all and outlawing Christianity. Later on, the ruthless suppression of Japanese converts who would not renounce their faith created a sickening number of martyrs. But that is later on.
Hideyoshi left five of his most powerful ``allies,'' in charge of the country and his young son. He hoped that none of the five daimyo would be able to successfully rebel against the other four and thus the stalemate might last long enough for his son to grow up and assume power. Nice plan, but it didn't work. Tokugawa Ieyasu, one of the most powerful daimyo and a member of the ruling council, defeated his enemies (all of them) and the supporters of Hideyoshi's heir at the Battle of Sekigahara in 1600. He did not unite the country so much as just destroy the power of the other daimyo (there were several hundred of them) to disturb the peace. Ieyasu's reward was the shogunate - that is, the emperor named him shogun in 1603. He moved the government (again, the emperor and his court remained in Kyoto) to Edo, which would be renamed ``Tokyo'' in 1868. Between 1600 and 1868, the Tokugawa family ruled a more-or-less feudal Japan.