Barton was appointed prime minister on 1 January 1901, the day on which the new federal constitution came into effect. He and various other dignitaries were driven through the streets of Sydney in a procession watched by thousands of onlookers, beginning in The Domain and ending at Centennial Park. A swearing-in ceremony for the new government was held at the purpose-built Federation Pavilion. The main focus was on Lord Hopetoun, Australia's first governor-general, who swore three separate oaths and read a message from Queen Victoria. Barton and his ministry only took oaths of allegiance, and were not formally sworn in to the Federal Executive Council until later in the afternoon. The events of the day were captured on film and distributed under the title Inauguration of the Commonwealth, although the visibility of the leading participants is poor. The film has been described as Australia's first feature-length documentary.
The first goal for Barton and his ministry was to retain office at the first federal elections, which were held in late March 1901. His old rival George Reid became the chief opponent of the government during the campaign and the de facto opposition leader. There were no national political parties in 1901, but most candidates self-declared as either protectionists or free-traders, following the primary divide in colonial politics. Reid, a free trader, made the tariff issue his primary focus, but its significance was diminished by the fact that the new federal government would have to depend on tariffs for its revenue. Barton instead delivered "an electoral masterstroke" by making White Australia the centrepiece of the government's campaign, thereby attracting many working-class voters concerned about "coloured labour". Supporters of the government won 32 out of the 75 seats in the House of Representatives, with their grouping calling itself the Protectionist Party (or Liberal Protectionists). Barton himself was elected unopposed in the Division of Hunter, having previously represented the area in the New South Wales parliament. The government's continuation was secured by the support of the newly formed Australian Labor Party (ALP), which had 17 MPs. Reid and his Free Trade Party formed the official opposition with 26 MPs. The situation in the Senate was similarly complicated, with the government's position even less secure. However, party discipline was virtually non-existent and Barton was widely seen as having won a mandate to govern.
Barton outlined his platform for the first federal election at a speech on 17 January 1901, delivered at the West Maitland Town Hall within his prospective electorate. His plans included the establishment of the federal capital, the High Court and the Inter-State Commission, and a "moderately protectionist tariff" in order to raise the revenue to introduce old-age pensions and a uniform postal system. He also promised to introduce universal suffrage for federal elections, build the Trans-Australian Railway, legislate to allow federal intervention in industrial disputes, and ban immigration from Asia and the Pacific Islands.
In April 1901, Barton announced that the government would sponsor a competition to design a new national flag for Australia. The winning design was the basis for the current Australian national flag, although Barton personally favoured the existing Australian Federation Flag that had been popular in New South Wales for many years. As it was primarily intended to be used in shipping, the design had to be submitted to the British Admiralty for approval and was not officially adopted until 1903.