Vitoria Mario's online fundraising page details how she has lived in the UK for four years after moving from Portugal.
But she is not eligible for maintenance loans or grants.
Vitoria said: "I was worrying too much about the money, what I have to do and if I have to look for a job. She actually made my dream come true."
The American singer,whose 16 top 10 British chart hits include the aptly titled Wildest Dreams, wrote a message on Vitoria's fundraising page as she confirmed her donation.
At that stage, Vitoria had collected nearly half of her £40,000 fundraising target, and Swift wrote: "Vitoria, I came across your story online and am so inspired by your drive and dedication to turning your dreams into reality.
"I want to gift you the rest of your goal amount. Good luck with everything you do! Love, Taylor."
Vitoria said her family could not afford to support her and she needed funds to help pay for her accommodation, a laptop, textbooks and general living costs. She said the approach from Swift had "come out of the blue".
The 18-year-old had written on her page: "Though my story is not unique, my dream of becoming a mathematician is not only a chance at social mobility for my family and I, but to inspire people who have been in similar positions to aspire to be the best version of themselves."
She added that she has always been "studious" and was unable to speak English when she moved to the UK in 2016.
Despite that disadvantage, she left school with two A*s and an A in her A-levels.
When coming to the UK, Vitoria had to make the difficult decision to leave Portugal, where her mother still lives.
"Moving away from her was a challenge but it was a sacrifice worth being made in my family's eyes," she added.
She estimated she would need £24,000 for accommodation, £3,000 for equipment and £13,000 for general living costs including food, transport, gas and electricity.
Swift has previously made a number of impromptu donations to fans whose stories she has read about online, including a New York photographer who asked for financial support via Tumbler.