"We consider that the appeal should be upheld and the order to enter prison suspended," the court said in a statement.
The suspension of the sentence will be for a period of four years as long as Hernandez does not commit any further crime and the payment of a fine of 96,000 euros ($111,000), the court said.
Hernandez, a World Cup winner with France in 2018, was arrested four years ago in Spain for violating a court order banning him from contacting his partner after a violent altercation between the pair.
He and his partner, Amelia Lorente, were both convicted of domestic violence in February 2017.
She hit and scratched Hernandez, while the player hit her in the ribs, back, and face, according to the court ruling at the time.
Neither made a complaint against the other, but both were charged by Spain's public prosecutor.
The then-Atletico Madrid player and his girlfriend were each sentenced to 31 days of community service. They were also ordered not to see each other for six months.
Four months later though, Hernandez was arrested at a Madrid airport.
He was in the company of Lorente, who was not arrested as her own restraining order had not yet been formally served. They were returning to Spain after marrying in the United States. The couple has since had a son.
Hernandez was sentenced in 2019 to six months in prison, a sentence he had appealed. It was the rejection of this appeal, on the grounds that he was a repeat offender, that led to this summons before a court in Madrid.
The court said Wednesday it had accepted Hernandez's appeal based on his current family situation and the low probability that he would commit a crime again.
"It cannot be ignored that the person who he was not supposed to approach consented to be approached," the court said in a reference to Lorente.
The court also pointed out that Hernandez lives with Lorente and their son and "there have been no new incidents between the couple."
"There are no records of him having committed any new crimes, which can be taken into account to conclude that it is not necessary for the sentence to be carried out to prevent him from committing another crime," the court added.
Hernandez became the most expensive player in Bundesliga history when he joined Bayern from Atletico in 2019 for 80 million euros.
Bayern currently sit at the top of the Bundesliga and are at the top of Group E in the Champions League.