Birmingham Crown Court was told a "one-in-a-billion" profile matching Osmond Bell, 59, was also discovered on  a letter sent to try and put suspicion of Nova Welsh's murder on others.
He denies murdering the mother of his two children in July 1981.
Ms Welsh was found dead in a cupboard at her home in Ladywood, Birmingham.
Opening the Crown's case, prosecutor Michael Burrows QC, said the tests could not have been carried out in 1981 but now the DNA can link him to the murder.
Ms Welsh, 24, was found in a utility cupboard at flats in Lighthorne Avenue on 18 August.
Mr Burrows said Bell, of Regent Road, Handsworth, sent a handwritten letter to a friend of Ms Welsh after she was reported missing and six days before her body was found.
The letter, seemingly written by a woman, claimed she had been attacked by a man she had been seen with on a night out.
A forensic examination of the envelope's seal, carried out in 2014, found an incomplete DNA profile allegedly matching Bell.
The jury was told the defendant would deny he had written the letter and maintain he last saw Ms Welsh on 25 July. She was killed during the early hours of 27 July.
"It was written before she was found and therefore before anyone innocent knew that Nova had been attacked and killed, rather than going away," Mr Burrows said.
He alleged Ms Welsh split with Bell after he tried to choke her in the kitchen.
"I understand that it's his case that his relationship with Nova was not volatile and that he was not violent towards her," he said.
"The killer used some kind of gum to secure the lock. He could not have anticipated that over 30 years alter, police would be able to link that chewing gum with him."
The trial continues.
The DNA of a man accused of murdering his lover 35 years ago was found on gum used to secure a lock on a cupboard containing her body, a jury has heard.