He was originally the ally of Oda Nobunaga. After his assassination, Toyotomi Hideyoshi came to the fore. However, despite his success in establishing control over the whole of Japan, his peasant status forbad him from receiving the rank of Shogun. Therefore when he eventually died, he hoped that his son would become Shogun, once he was old enough.
Ieyasu was one of a committee of five tairo, or regents, set up to look after Hideyoshi's son. They worked hand-in-hand with five bugyo, or commissioners. However he was not easily going to pass up the opportunity if seizing power. Hideyoshi's son was far too young to govern. Thus he installed himself in Fushumi Castle, Hideyoshi's old headquaters. He was viewed as a usurper by some. Eventually events came to a head over a quarrel concerning political marriages. In that time, however, most marriages had political facets, in order to seal alliances and gain influence. In noble families, men and women rarely married for love.
Though political marriages had been "banned", Ishida Mitsunari, one of the bugyo, knew that he was deliberately trapping Ieyasu. He tried to order him to commit seppuku, or ritual suicide. Ieyasu fled, however. This was a virtual declaration of war and both sides mobilised their forces.
Despite having larger forces, the Western Army, which was loyal to the young prince, eventually lost. Ieyasu, commanding the Eastern Army, had been very prudent. He had secretly tempted daimyo at the heart of the Western Army to serve him. Thus, at the final battle of Sekigahara, Mitsunari watched helplessly as parts of his army refused to engage the enemy, or attacked their own side. It was a total victory for Ieyasu.
In the aftermath, he established a new Shogunate. Contact with the outside world was heavily restricted and technological innovation was banned. Ieyasu was not power-hungry, though. A mere five years after becoming Shogun, he resigned in favour of his son. He was happy enough in establishing the Shogunate.
Sources
Anthony Bryant, Sekigahara 1600