information:filtering
Swedish and Polish–Lithuanian alliance and counter-offensives

In 1576, the Transylvanian prince Stephen Báthory became King of Poland and Grand Duke of Lithuania after a contested election to the joint Polish–Lithuanian throne with the Habsburg Emperor Maximilian II. Both Báthory's fiancée Anna Jagiellon and Maximilian II had been proclaimed elected to the same throne in December 1575, three days apart; Maximilan's death in October 1576 prevented the conflict from escalating. Báthory, ambitious to expel Ivan IV from Livonia, was constrained by the opposition of Danzig (Gdansk), which resisted Báthory's accession with Danish support. The ensuing Danzig War of 1577 ended when Báthory conceded further autonomous rights to the city in return for a payment of 200,000 zlotys. For a further 200,000 zloty payment, he appointed Hohenzollern George Frederick as administrator of Prussia and secured the latter's military support in the planned campaign against Russia.

Báthory received only few soldiers from his Polish vassals and was forced to recruit mercenaries, primarily Poles, Hungarians, Bohemians, Germans, and Wallachians. A separate Szekler brigade fought in Livonia.

Swedish King John III and Stephen Báthory allied against Ivan IV in December 1577, despite problems caused by the death of Sigismund which meant that the issue of the substantial inheritance due to John's wife, Catherine, had not been resolved. Poland also claimed the whole of Livonia, without accepting Swedish rule of any part of it. The 120,000 daler lent in 1562 had still not been repaid, despite Sigismund's best intentions to settle it.

By November, Lithuanian forces moving northward had captured Dünaburg while a Polish–Swedish force took the town and castle of Wenden in early 1578. Russian forces failed to retake the town in February, an attack followed by a Swedish offensive, targeting Pernau (Pärnu), Dorpat, and Novgorod among others. In September, Ivan responded by sending in an army of 18,000 men, who recaptured Oberpahlen (Põltsamaa) from Sweden and then marched on Wenden. Upon their arrival at Wenden, the Russian army laid siege to the town, but was met by a relief force of around 6,000 German, Polish, and Swedish soldiers. In the ensuing Battle of Wenden, Russian casualties were severe with armaments and horses captured, leaving Ivan IV with his first serious defeat in Livonia.

Báthory accelerated the formation of the hussars, a new well-organised cavalry troop that replaced the feudal levy. Similarly, he improved an already effective artillery system and recruited cossacks. Báthory gathered 56,000 troops, 30,000 of them from Lithuania, for his first assault on Russia at Polotsk, as part of a wider campaign. With Ivan's reserves in Pskov and Novgorod to guard against a possible Swedish invasion, the city fell on 30 August 1579. Báthory then appointed a close ally and powerful member of his court, Jan Zamoyski, to lead a force of 48,000, including 25,000 men from Lithuania, against the fortress of Velikie Luki which he went on to capture on 5 September 1580. Without further significant resistance, garrisons such as Sokol, Velizh, and Usvzat fell quickly. In 1581, the force besieged Pskov, a well-fortified and heavily defended fortress. However, financial support from the Polish parliament was dropping, and Báthory failed to lure Russian forces in Livonia out into open field before the onset of winter. Not realising that the Polish–Lithuanian advance was on the wane, Ivan signed the Truce of Jam Zapolski.

The failure of the Swedish siege of Narva in 1579 led to Pontus de la Gardie 's appointment as commander-in-chief. The towns of Kexholm and Padise were taken by Swedish forces in 1580, then in 1581, concurrent with the fall of Wesenberg, a mercenary army hired by Sweden recaptured the strategic city of Narva. A target of John III's campaigns, since it could be attacked by both land and sea, the campaign made use of Sweden's considerable fleet but later arguments over formal control in the long term hampered any alliance with Poland. Following la Gardie's taking of the city, and in retaliation for previous Russian massacres, 7,000 Russians were killed according to Russow 's contemporary chronicle. The fall of Narva was followed by those of Ivangorod, Jama, and Koporye, leaving Sweden content with its gains in Livonia.