Toyota take hard-fought win at home race