The Swiss Northern Railway (German: Schweizerische Nordbahn, SNB), informally known as the Spanisch-Brötli-Bahn, opened the first railway line within Switzerland in 1847, the Zürich-Baden railway. This followed the extension of a French railway to Basel in 1844. The original line generally followed the south bank of the Limmat from Zürich to near its confluence with the Aar near Brugg and then it generally followed the south bank of the Aar to Olten. It was absorbed into the Swiss Northeastern Railway (German: Schweizerische Nordostbahn, NOB) in 1853 and extended from Baden to Brugg in 1858. The line was absorbed into the Swiss Federal Railways on its establishment in 1902. It is electrified at 15 kV 16.7 Hz and its eastern 16 km section from Zürich to Killwangen-Spreitenbach is now part of the Zürich-Olten trunkline and has four tracks.
The section between Zürich and Baden was opened on 7 August 1847 by the Swiss Northeastern Railway. It was the first line built in Switzerland, except for the line built from Mulhouse to Basel by the French company Chemin de fer de Strasbourg à Bâle, opened to a temporary station outside Basel's walls on 15 June 1844 and to the permanent station on 11 December 1845. The construction of railways in Switzerland was delayed compared to most of its neighbours, partly as a result of its mountainous geography. In addition the cantons were in a position to influence the routes chosen, particularly because of the need for compulsory purchase to build railways. In 1836 Friedrich Hünerwadel of Lenzburg pointed out to the government of the canton of Aargau--through which the line had to pass--the importance of the route of a railway from Zurich to Basel for Aargau's commerce and industry.
In 1837, the Zürich Chamber of Commerce commissioned the engineer Alois Negrelli to investigate the route of such a line. In October of the same year the Zurich-Basel railway company was founded. The chosen route would lead from Zürich to Würenlos via Dietikon along the south bank of the Limmat, then crossing the river to follow the north bank of the Limmat via Wettingen, Ennetbaden and Obersiggenthal. In Untersiggenthal the line would turn to the north and have crossed the Aare at Döttingen. It would have then followed the south bank of the Rhine to Basel. In April 1838 surveying of the route began, but angry residents obstructed their work. The Züriputsch of 1839 and a civil war-like constitutional dispute in the canton of Aargau further delayed the start of construction.
In addition the route of the line was controversial. Some called for a line through the Bözberg Pass, which was the route of the Bözberg line opened in 1875. Although the Aargau parliament passed a law permitting compulsory purchase in November 1840, several shareholders lost their financial guarantees, and the company had to be dissolved in December 1841. In May 1843 representatives of the cantons of Aargau, Zurich and Basle met in the Baden City Hall, but they failed to come to any agreement.
In May 1845 a new committee was formed under the leadership of the Zurich industrialist Martin Escher. The planned line would now keep to the south bank of the Limmat, which it would only cross at Turgi. Finally, it was planned to cross the Rhine between Koblenz and Waldshut (then in the state of Baden) to connect with the planned Baden Mainline between Basel and Konstanz. With an assurance that Alois Negrelli would direct the engineering and that a branch line would be later built from Baden to Lenzburg and Aarau, the Aargau parliament approved the project in July 1845. The first stage of construction would be the section from Zurich to Baden. The gauge of was chosen, the same gauge as the German Grand Duchy of Baden State Railway, which was also constructed during that time
Negrelli relocated the station in Baden to the north side of the town, requiring the construction of the 80-meter-long Schlossberg tunnel. Gustav Albert Wegmann designed the Zürich railway station, while Ferdinand Stadler designed the Baden station. At the end of 1845 the Nordbahn company was founded with a share capital of 20 million francs, in the spring of 1846 construction work started. The route for the most part was easy, although there were small landslides between Neuenhof and Baden. The greatest challenge was the construction of the Schlossberg tunnel, where prisoners were initially used for this work; later unskilled workers were also used there. There were three fatalities in a blasting accident and an additional six workers died of typhoid. The tunnel was broken through on 14 April 1847.
The line opened on 7 August 1847 and was the first line located entirely on Swiss territory. Shortly after 11:30 am, the arrival of the first official train in Zurich was announced with gun salute. He brought the invited guests and members of the Aargau authorities from Baden to Zurich. The locomotive No. 1 «Limmat» required only 23 minutes, which would correspond to an average speed of 42 km / h. After celebrations and sightseeing of the train station infrastructure the train left Zurich for Baden at 13:00 with 140 invited guests; scheduled operations started two days later. Every day there were four trips in each direction. The 20 km journey took 45 minutes with the trains stopping at Altstetten, Schlieren and Dietikon. Soon after the opening, the line began to be called the "Spanisch-Brötli bahn" ("Spanish bun railway") because the Zürich gentry sent their servants by train to Baden to buy these buns in order to impress their clients at Sunday morning teas. Previously their servants had to set out from Baden at midnight on foot with the buns. The buns were apparently derived from buns made in Milan during the 17th century when it was under Spanish control. Under the laws of the canton they could only be made in Baden.
The railway had little commercial success. Its passenger numbers were reduced by the Sonderbund war and the Revolutions of 1848 in neighboring countries. The Nordbahn dropped one of the daily services and indefinitely delayed the construction of further stages. Construction of the branch line from Baden to Lenzburg and Aarau was abandoned. Eventually, the company succeeded in coming to an agreement with the postal administration so that the coach service to Bern no longer ran on the Zurich-Baden section, but the coach service between Zurich and Basel continued to run beside the railway.
Only after the enactment of the Federal Railways Act of 1852--made possible by the new constitution of 1848--and the merger of the company with Alfred Escher's Bodensee und Rheinfallbahnen ("Lake Constance and Rhine Falls Railway") to form the Schweizerische Nordostbahn ("Swiss Northeast Railway") in 1853 were construction plans resumed and the original line was regauged to . The line was opened to Brugg in 1858, where it met the line from Olten built by the Schweizerische Centralbahn.