The Spaniard, who has never gone beyond the quarter-finals in a grand slam, grew in confidence in the second set, however, with the backing of the home support on the Manolo Santana court and saved two break points before forcing a decider.
An upset looked on the cards when Almagro broke Djokovic at the first attempt in the third set and marched into a 3-0 lead but the Serb drew on his experience to battle back, breaking the 31-year-old twice before serving out for the match.
The Serbian, who recently split from his long-term coach Marian Vajda, is on a quest to regain his best form again ahead of the French Open.
Later on Wednesday crowd favourite and four-time winner Rafael Nadal enters the tournament to face Italy's Fabio Fognini.
In the third round of the women's singles Eugenie Bouchard plays Angelique Kerber of Germany, having seen off Maria Sharapova on Monday in a thriller.
(Editing by Richard Lough)
Share
