Around 1557 he returned to Owari and joined the Oda clan as a lowly servant. He became one of Nobunaga's sandal-bearers and was present at the
Battle of Okehazama in 1560 when Nobunaga defeated
Imagawa Yoshimoto to become one of the most powerful warlords in the Sengoku period. According to his biographers, he supervised the repair of
Kiyosu Castle, a claim described as "apocryphal", and managed the kitchen. In 1561, Hideyoshi married
Nene. He carried out repairs on
Sunomata Castle with his younger brother
Toyotomi Hidenaga and the bandits
Hachisuka Masakatsu and
Maeno Nagayasu. Hideyoshi's efforts were well received because Sunomata was in enemy territory. He constructed a fort in
Sunomata, according to legend overnight, and discovered a secret route into Mount Inaba after which much of the garrison surrendered.
Hideyoshi was very successful as a negotiator. In 1564 he managed to convince, mostly with liberal bribes, a number of
Mino warlords to desert the
Saito clan. Hideyoshi approached many Saito clan samurai and convinced them to submit to Nobunaga, including the Saito clan's strategist
Takenaka Hanbei. Oda Nobunaga's easy victory at
Inabayama Castle in 1567 was largely due to Hideyoshi's efforts. Despite his peasant origins, Hideyoshi became one of
Oda Nobunaga's most distinguished generals, eventually taking the name Hashiba Hideyoshi. The new surname included two characters, one from one of Oda's two other right-hand men,
Niwa Nagahide and
Shibata Katsuie.
Hideyoshi led troops in the
Battle of Anegawa in 1570 in which Oda Nobunaga allied with future rival
Tokugawa Ieyasu (who would eventually displace Hideyoshi's son and rule Japan) to lay siege to two fortresses of the
Asai and
Asakura clans. In 1573, after victorious campaigns against the Asai and Asakura, Nobunaga appointed Hideyoshi daimyo of three districts in the northern part of
Ōmi Province. Initially based at the former Asai headquarters in Odani, Hideyoshi moved to Kunitomo, and renamed the city
Nagahama in tribute to Oda Nobunaga. Hideyoshi later moved to the port at Imahama on
Lake Biwa. From there he began work on Imahama Castle and took control of the nearby Kunitomo firearms factory that had been established some years previously by the Asai and Asakura. Under Hideyoshi's administration the factory's output of firearms increased dramatically.
After the
assassinations at Honnō-ji of Oda Nobunaga and his eldest son
Nobutada in 1582 at the hands of
Akechi Mitsuhide, Hideyoshi defeated Akechi at the
Battle of Yamazaki.
At a meeting at Kiyosu to decide on a successor to Nobunaga, Hideyoshi cast aside the apparent candidate,
Oda Nobutaka and his advocate, Oda clan's chief general, Shibata Katsuie, by supporting Nobutada's young son,
Oda Hidenobu. Having won the support of the other two Oda elders, Niwa Nagahide and
Ikeda Tsuneoki, Hideyoshi established Hidenobu's position, as well as his own influence in the Oda clan. Tension quickly escalated between Hideyoshi and Katsuie, and at the
Battle of Shizugatake in the following year, Hideyoshi destroyed Katsuie's forces and thus consolidated his own power, absorbing most of the Oda clan into his control.
In 1583, Hideyoshi began construction of
Osaka Castle. Built on the site of the temple
Ishiyama Honganji destroyed by Nobunaga, the castle would become the last stronghold of the Toyotomi clan after Hideyoshi's death.
Nobunaga's other son,
Oda Nobukatsu, remained hostile to Hideyoshi. He allied himself with
Tokugawa Ieyasu, and the two sides fought at the inconclusive
Battle of Komaki and Nagakute. It ultimately resulted in a stalemate, although Hideyoshi's forces were delivered a heavy blow. Finally, Hashiba made peace with Nobukatsu, ending the pretext for war between the Tokugawa and Hashiba clans. Hideyoshi sent Tokugawa Ieyasu his younger sister and mother as hostages. Ieyasu eventually agreed to become a vassal of Hideyoshi.