From the junction with its Saalach tributary in the northern Salzburg basin, the Salzach forms the border between Bavaria, Germany and the Austrian states of Salzburg and Upper Austria for almost 70 kilometers .