Margaret Dickson, 72, had worked as a primary school teacher and a police officer but later lived modestly in her tenement flat in Glasgow's east end. She died in March last year from lung cancer.
Ms Dickson, who never married, had never shown signs of her wealth, although she was known to love travelling.
The money from her estate will be divided up between several charities, with Cancer Research UK and the British Heart Foundation receiving £250,000 each. She also left money to friends and relatives.
Her cousin, Jean Brock, 63, of Glasgow, said: "We were appointed as executors so we got to see her will and we were shocked to see how much money she had.
"She lived in a very nice but modest flat but certainly did not live an extravagant lifestyle."
Ms Brock said her cousin had three separate bank accounts each containing £100,000 and that the rest of her wealth came from stocks and shares. She also had premium bonds and would regularly receive prize cheques.
She added: "Margaret was an only child so her bachelor uncle, who worked as a stockbroker, invested money for her and he seems to have invested very wisely. Nobody had any idea how much the will was worth or just how much her wealth had accumulated."
Ms Dickson was a teacher at Ruchazie Primary before moving to London in 1972, where she joined the Metropolitan Police Service. In 1986 she retired from the force on health grounds after she was injured by falling scaffolding while on duty.
She never worked again and split her time between London and Glasgow until settling permanently in Riddrie in 2005.
Her total estate was worth £1,119,455.73 and she left £20,000 to family and friends.
But her last wishes saw her gift £250,000 each to Cancer Research UK and the British Heart Foundation.
Children's charity Barnardo's, the National Institute For The Blind and the Royal National Lifeboat Institute were each left £180,000.
Her flat was worth £72,500 and her personal belongings were worth just £2000.
She had £63,000 of shares in Marks and Spencer, £62,000 of shares in British American Tobacco and £230,000 invested in Government-backed saving scheme National Savings And Investments.
Ms Dickson also had thousands of pounds in cash in various bank accounts.
She became ill just after her 70th birthday when doctors discovered a shadow on her lung that turned out to be cancerous. She died in the Marie Curie Hospice, Stobhill.
Mrs Brock added: "It was very quick. She was getting weaker and weaker until we decided she was not fit enough to live by herself so we got carers in before she moved into the hospice for the last seven weeks of her life.
"But at least she was comfortable in her final days."
Mrs Brock added: "All through her life, in work and in retirement, she enjoyed travelling and visited nearly every major European city, as well as going to India, China, South America and Nepal. She even went to the Amazon once."
Michelle Dean, of Cancer Research UK, said: "We are so grateful to Miss Dickson for thinking of the charity's lifesaving work when making her will."
Marjory Burns, of British Heart Foundation Scotland, added: "Research funded by people leaving gifts in wills to the Foundation is helping to save more lives and to keep more families together.
"We are extremely grateful to Miss Dickson and everyone who supports our work in this way."