Ueda Castle (Japanese: 上田城) was the original home of the Sanada clan, built by Sanada Masayuki.
It was this castle that the Sanada defended twice from the Tokugawa, first in 1583 and again in 1600, putting up a very impressive defense both of those times.
When Sanada Masayuki refused to hand over the Numata Castle to Tokugawa Ieyasu, it led to The Battle at Kami River. During the battle, Ieyasu charged into the Ueda Castle with a very large army. But Masayuki was ready, having an ambush party ready to attack. This effectively threw the Tokugawa army into great confusion, causing them great losses in numbers.
Masayuki and his son Sanada Yukimura both faced off against the Tokugawa once again at the Battle of Sekigahara. The Sanada announced their surrender, but this surrender was all part of Masayuki's plan. He wanted to make them think he was truly surrendering, but instead Masayuki was really in preparation for the defense of the Ueda Castle.
When Tokugawa Hidetada was alerted of the Sanada clan's plot, Hidetada began to mobilize his troops. But Masayuki was already prepared for an attack, so he had another ambush party ready, but this time he sent them into the enemy's main camp. In the end the battle had devastating effects. Hidetada failed to seize the Ueda Castle, and he was also kept from joining the field at Sekigahara.