Victoria Allen, 51, threatened to take Brannel School in St Austell, Cornwall to tribunal over the matter.
The dispute was settled out of court earlier.
She had told the pupil she did not agree with same sex relationships and she was unhappy that the rainbow emblem was used to represent gay pride.
More on the teacher row, plus more Devon and Cornwall news
Both parties spent the day behind closed doors at Bodmin Magistrates' Court thrashing out an agreement.
A joint statement said head teacher Andy Edmonds "recognised Victoria Allen's right to share her Christian beliefs with students and has apologised for any upset that Victoria Allen may have felt during the disciplinary process".
Outside the court, Mrs Allen said she was made to "feel like a criminal" for sharing her "personal, Biblical beliefs".
She said she believes the rainbow emblem, often used to represent the gay community, should indicate "God's promise not to flood the world again".
Mrs Allen said the student asked her a direct question about her personal religious beliefs.
"If a child asks my personal opinion I feel I should give it," she said.
In the statement, Mrs Allen acknowledged that staff "should share balanced views".
Libby Powell of the Christian Legal Centre, which supported Mrs Allens' claim, said: "Vicky was asked a question about her personal opinion.
"We know that there are lots of people who disagree with the Biblical view of marriage and they are free to disagree.
"What we want to say is that there has to be space for the other point of view, Vicky's point of view, to be there as well."

One of Afghanistan's largest cities, it has long been a strategically important transport hub for the north of the country.
Kunduz is linked by highways to Kabul in the south, with Mazar-e-Sharif in the west and with Tajikistan in the north.
But it has always held symbolic significance for the Taliban because it was a key northern stronghold before 2001.
Kunduz is considered a gateway to Afghanistan's northern provinces and shares a border with Tajikistan, Afghanistan's Central Asian neighbour.
The border with Tajikistan is porous, and it is used for the smuggling of Afghan opium and heroin to Central Asia, which finally finds its way to Europe.
Any side controlling Kunduz would not only influence the surrounding areas, but could also control one of the most important drug smuggling routes in the region.
Security for the region - which was a flagship project for the German army - was transferred to Afghan forces in 2013.
But Kunduz has many other problems: bad governance as well as incompetence and intimidation by some local officials have alienated many in the province.
It has long been at the frontline of a determined campaign by the Taliban to reclaim it. In May last year the BBC's David Loyn reported from there as fighting between government forces and the Taliban unfolded.
The Taliban already control huge chunks of the province's rural areas, where the majority of the population lives. The insurgents have intensified their fighting in the province over the past two years.
A BBC reporter visited the city after it was back in government hands following its September 2015 capture. He found shock, a jail emptied of prisoners and many residents fearful of a Taliban return.
The battle for the city saw one of the worst incidents in the recent Afghan war when a Medecins sans Frontieres hospital was hit by a US air strike.
The city is  estimated to have about 300,000 residents but those numbers are likely to be fluid because fighting has prompted many to flee the city.
Tens of thousands of people were displaced, living in shelters, spread across large tracts of countryside.
Although the insurgents were pushed back, they always had numbers in the region and many observers believed it was only a matter of time before a determined assault was attempted.
BBC Afghan's Dawood Azami and Inayatulhaq Yasini contributed to this report.
A school has apologised to a Christian teaching assistant it disciplined for sharing her views on gay relationships with a 14-year-old student.
[NEXT_CONCEPT]
The brief militant seizure of Kunduz in 2015 was one of the Afghan government's worst setbacks since Taliban forces were ousted in 2001.