In 1883 William Mackay began practicing as a doctor for the Rio Tinto mining company in Minas de RiotintoHuelva, Andalusia, Spain. His brother, John Sutherland Mackay, was the company's chief medical officer. In 1883 medical provision for Rio Tinto staff was limited to that provided by the Spanish Provincial Hospital. William inspected the Spanish Provincial Hospital in 1883 and reported to the Board of the Rio Tinto Company that the hospital was insanitary and crowded: "Small windows, placed near the roof, and clammy walls, complete the picture of a mediaeval prison". The Rio Tinto Company subsequently built the English Hospital in 1884 solely for the use of their employees. William Mackay was responsible for the plan and construction of the English Hospital. In addition to Rio Tinto employees, William tended to the local poor for free on Thursdays. William's experiences of working as a doctor at the Hospital, and in private practice, formed the basis of the MD thesis he submitted to the University of Edinburgh in 1889 with the title Surgery in Spain.
Founding of Recreativo de Huelva
William and another Scottish doctor, Robert Russell Ross, founded a sports club for Rio Tinto Company workers. The club was originally named Huelva Recreation Club and was intended to provide physical recreation for the workers in order to improve their health. It was officially established as Recreativo de Huelva on 23 December 1889. Although the club is now known as Spain's oldest football club, their activities were not originally restricted to football: Mackay invited Ildefenso Martinez to play cricket in 1888 and the club organised rugby matches in 1910.
Personal life
William Mackay's wife and their four children all died of a hereditary disease within six years of each other, between 1896 and 1902. His son Alexander died in 1896, wife Catherine and son Juanito in 1898, and daughters Anita and Molly in 1902. William Mackay was named an adopted son of the city of Huelva in 1923, and the street he lived in was named after him. On receiving this honour, he said:
"The greatest sadness of my life I have suffered in Huelva, and here I have enjoyed the greatest happiness, too."
Death
William Mackay returned to Scotland in 1924 and died at Heathmouth, Ross-shire, on 14 July 1927 at the age of 67. He is buried at Logie Easter Cemetery.