Until now, they had been banned by the organisers, who won support for their stance from the US Supreme Court.
But the organisers, the South Boston Allied War Veterans Council, had a change of heart and told Boston Pride and Outvets, representing gay military veterans, they were welcome.
St Patrick's Day parades celebrate Irish and Irish-American culture.
"Finally in the city of Boston we're seeing the inclusivity we never thought we would see," said Outvets founder Bryan Bishop, "This is personally one of the greatest days of my life."
In 1995 the Supreme Court upheld a ban on gay and lesbian groups, citing free speech rights. The organisers had argued that it violated their Roman Catholic doctrine.
But the Veterans Council changed its position and its commander, Brian Mahoney, is quoted as saying "who am I to judge?" when asked about the issue of sexual orientation.
The Boston mayor marched in the parade for the first time in 20 years. Previously mayors had boycotted the event due to its ant-gay stance but this year Mayor Marty Walsh joined marchers.
"With this year's parade, Boston is putting years of controversy behind us," he said.
Boston is the capital of Massachusetts, which became the first US state to allow gay marriage in 2004.
Gay and lesbian groups have officially joined a St Patrick's Day parade in the US city of Boston for the first time.