The 66-year-old was found guilty of trying to bribe a magistrate by offering him a prestigious job in return for information about a separate criminal case against Sarkozy.
He is the first former French president to receive a custodial sentence.
The magistrate and Sarkozy's former lawyer got similar sentences. All three defendants are expected to appeal.
In the ruling, the judge in Paris said Sarkozy could serve a year at home with an electronic tag, rather than go to prison.
The conservative politician "knew what [he] was doing was wrong", the judge said, adding that his actions and those of his lawyer had given the public "a very bad image of justice".
The crimes were specified as influence-peddling and violation of professional secrecy.
It is a legal landmark for post-war France. The only precedent was the trial of Sarkozy's predecessor Jacques Chirac, who got a two-year suspended sentence in 2011 for having arranged bogus jobs at Paris City Hall for allies when he was Paris mayor. Chirac died in 2019.
Prosecutors had sought a four-year jail sentence for Sarkozy, half of which would be suspended.
The case centred on conversations between the magistrate involved, Gilbert Azibert, and Thierry Herzog, Sarkozy's then lawyer, which were taped by police in 2014.
The investigators were looking into claims that Sarkozy had accepted illicit payments from the L'Oreal heiress Liliane Bettencourt for his 2007 presidential campaign.
The phone line they tapped was a secret number set up in a fictional name, Paul Bismuth, through which Sarkozy communicated with his lawyer.
Sarkozy is also due to go on trial in a separate case, from 17 March to 15 April, which relates to the so-called Bygmalion affair. Sarkozy is accused of having fraudulently overspent in his 2012 presidential campaign. He had served as president since 2007 - but his 2012 re-election bid was unsuccessful.
Despite his legal entanglements Sarkozy has remained popular in right-wing circles, a year away from a presidential election.