Anna was the eldest daughter of Holy Roman Emperor Maximilian II and his first cousin, Maria of Spain. She was born in Spain during her maternal grandfather, Emperor Charles V's reign, but moved to Vienna when she was four years old. Anna was said to be her father's favourite child.

According to legend, he liked playing and gambling with her; on one occasion, a meeting of the Estates of Hungary was postponed due to Anna's illness. Despite her father's Lutheran sympathies, she got a Catholic education.

Anna was a popular bride-to-be at European courts since she was the eldest daughter of the Holy Roman Emperor. Her parents hoped that her marriage to a Spaniard would improve ties between the Austrian and Spanish Habsburg houses. Her nephew Don Carlos, the sole son of her maternal uncle Philip II of Spain, was first considered. When Don Carlos died in 1568, his ambitions were destroyed.

In 1568, Elisabeth of Valois, Philip's third wife, died in childbirth; in 1568, a Spanish marriage plan was resurrected. Philip was left widowed with two young children, Isabella Clara Eugenia and Catherine Michelle. Philip intended to remarry since he lacked a male heir. Many people, including Pope Pius V, were initially opposed to the marriage, but it was eventually arranged.

Anna's engagement was announced to her uncle Philip II in February 1569, and they married by proxy in May 1570. In the fall of 1570, Anna moved from Austria to Spain with her brothers Albert and Wenceslaus. Anna made her way across the English Channel, where Elizabeth I dispatched her admirals, Charles Howard and William Wynter, to provide assistance and safe passage.

They proceeded via the Netherlands, where Anna was met by friends and relatives of Floris of Montmorency, the executed Count of Horn's younger brother. Since 1567, Floris had been imprisoned in Spain. Floris' relatives and friends hoped for mercy now that King Philip had gone into a new marriage.

They got a promise from the future queen that she would do everything she could to rescue Floris; unfortunately, she was unsuccessful, and Floris was murdered on the King's orders. On 3 October, Anna arrived in Spain, but before she could reach the King, Floris was secretly executed on 16 October 1570.

Upon her arrival in Spain, Anna was given a new household under the leadership of the experienced and influential lady-in-waiting Margarita de Cardona, who had previously been her mother's lady-in-waiting and would have known her from her youth in Austria.

Queen Anna was characterised as lively and cheery, and she managed to lighten the mood at the Spanish court. Anna kept herself primarily busy with needlework. Anna and Philip's marriage is regarded as pleasant. Anna was allegedly Philip's favourite wife as well as her father's favourite child. Diplomats said that the monarch was madly in love with his young wife.

There is no evidence that Philip had mistresses throughout their marriage. Anna had a personality similar to his own, and he was utterly committed to her. Philip was a diligent monarch who maintained his relationship with Anna through notes twice a week and visited her bed-chamber three times a day.

Anna bore five sons, the elder three of whom died before Philip, and the youngest who finally succeeded him as Philip III. Isabella Clara Eugenia and Catherine Michelle were likewise characterised as having a good stepmother in Anna.

Badajoz was the temporary setting for the court in 1580 due to Philip II's claim to the Portuguese crown. She died of influenza there, eight months after giving birth to her final child, Maria, who outlived her mother by three years. Anna was buried at Badajoz at first, but her corpse was eventually moved to El Escorial.