David Ferrer needed all his fighting qualities to come out on top of an enthralling all-Spanish encounter with Nicolas Almagro at the Australian Open.