A young Moldovan dancer who was on the bridge of the Costa Concordia cruise liner with Captain Francesco Schettino when it capsized last year told an Italian court she had been his lover.
Domnica Cemortan had previously denied any affair with Captain Schettino.
Captain Schettino faces multiple charges including manslaughter.
Ms Cemortan's confession may prompt prosecutors to query the quality of her testimony, which had shown him in a positive light.
She has described Captain Schettino as a "hero" and has said he deserved gratitude for bringing the ship nearer to shore rather than letting it sink out at sea.
32 people died when the boat hit a reef and partially sank on 13 Jan 2012, off the Tuscan island of Giglio.
It had been carrying more than 4,000 passengers and crew.
At today's hearing, the second day of witness testimony in Mr Schettino's trial, Ms Cemortan initially refused to say whether she had a "love story" with the captain, who is married.
After being warned she faced contempt of court charges if she did not reply, Ms Cemortan said, in Romanian through an Italian translator: "Yes, I had a relationship with him."
Ms Cemortan said she had not seen Mr Schettino since the shipwreck.
She also confirmed she had boarded the ship that same day without a ticket, adding: "When you're somebody's lover they don't ask you for a ticket".
The dancer, who is in her mid-20s, had previously said she was just a friend of the captain, that they had dined together before the shipwreck and that she had joined him on the bridge as a guest when he steered the ship too close to Giglio island.
The trial is being held in a specially adapted theatre in the Tuscan city of Grosseto due to the global media interest.
After Ms Cemortan left the court room, she told reporters in English she was unhappy to have been forced to reveal her relationship with Mr Schettino "because it is my private life".
The trial reopened last month after an operation to raise the Concordia, which had been lying on its side, opened the way for a search for clues on what had caused the accident.
Mr Schettino is the only person on trial after four crew members and an official of the ship operator Costa Cruises, a division of Carnival Corp, were sentenced to terms of up to 34 months in prison after pleading guilty last year.
Apart from manslaughter, Mr Schettino also faces charges ofcausing a shipwreck and abandoning ship.