Her son the Duke of York - in his first public appearance since settling a civil sex assault case - accompanied her to Westminster Abbey.
Prince Philip, who died last year aged 99, was described as a "remarkable man" committed to "down-to-earth" causes.
The service was organised as Covid rules meant his funeral, held almost a year ago, had only 30 people present.
Representatives of many of his charities - including the Duke of Edinburgh Award - attended Tuesday's service, which had 1,800 people in attendance.
It was the first major event this year attended by the 95-year-old monarch, who travelled by car from Windsor Castle with Prince Andrew.
There had been doubts she would attend, and she only made the final decision in the hours before the service.
The Queen has had mobility problems and had to pull out of the Commonwealth Service earlier this month. She also tested positive for Covid in February.
Special measures were put in place for her comfort, including keeping the length of the service to 45 minutes.
Amid these health concerns, there was nervousness on Tuesday morning among people awaiting confirmation that the Queen would be able to attend, our BBC's royal correspondent Sean Coughlan says.
Unlike the funeral in Windsor last April, where the Queen was poignantly pictured sitting alone, she had close family members in all the seats around her.
The Queen and Prince Philip's two elder children, Prince Charles and Princess Anne, were sitting in the same row as her.
Prince William and his wife Catherine were in the row directly behind along with two of the Queen's great-grandchildren, Prince George and Princess Charlotte.
The Queen's other two sons, Prince Andrew and Prince Edward, also had front row seats, across the aisle from the Queen.
But Prince Harry, who has been in a legal dispute over the provision of security, did not travel from California, where he lives.
Political leaders including Prime Minister Boris Johnson and Labour leader Sir Keir Starmer were among the guests, as were representatives from European royal families, including from the duke's native Greece.
The service was stamped with the personality of Prince Philip, with many of the elements originally intended for his funeral at St George's Chapel included.
Those elements included the entry to Westminster Abbey being lined by Duke of Edinburgh gold award winners as mourners arrived.
One winner of the prestigious award, Doyin Sonibare, gave a speech where she explained she originally wasn't "sold on the idea", as she had never been camping before and had a fear of climbing steep hills.
The 28-year-old award ambassador from east London said: "I kept thinking I was going to trip up, roll down the mountain and 'it's lights out for Doyin'. Fortunately for me, that didn't happen.
"I remember thinking to myself, if I could complete this expedition, I can do anything."
The hymn Guide Me, O Thou Great Redeemer, also intended for the funeral, was sung, and there was music by Beethoven, JS Bach, Wagner, Vaughan Williams and William Byrd heard during the service.
The Queen is also said to have been closely involved in the planning of the service.
Dean of Windsor David Conner - a long-time friend of Prince Philip who also conducted his funeral - told the congregation at this service that the duke's life "bore the marks of sacrifice and service".
"Certainly, he could show great sympathy and kindness. There is no doubt that he had a delightfully engaging, and often self-deprecating, sense of humour.
"It is quite clear that his mind held together both speculation and common sense. Moreover, nobody would ever doubt his loyalty and deep devotion to our Queen and to their family."
He told the congregation the duke was "practical" and "devoted his astonishing intellectual and physical energy, his enormous capacity for sheer hard work, to a host of down-to-earth enterprises".
"These included the equipping of young people to face tomorrow's challenges, the encouragement of respect and care for the natural order, and his pioneering work in facilitating conversation between representatives of the different world faiths," he said.
He also pointed out that the duke could be "abrupt" and sometimes "forget just how intimidating he could be".
"A kind of natural reserve sometimes made him seem a little distant. He could be somewhat sharp in pricking what he thought to be bubbles of pomposity or sycophancy.
"On the other hand, we should not forget that he himself was sometimes wounded by being unfairly criticised or misunderstood.
This thanksgiving service brought together the strands of Prince Philip's life: his wife of 73 years, his family, his charities, his military connections, his sense of public duty.
But in his sermon, the Dean of Windsor, David Conner, said Prince Philip would have hated to have been remembered as a "plaster saint".
He described a real-life man, full of energy and ideas, but who had no patience for pomposity or flattery.
There was also attention on the real-life frailties of the Queen, who walked to her seat as the first hymn had started.
She sat in the same church where she was married to Prince Philip, stick at her side, with four generations of her family present and decades of memories.
Prince Andrew, making his own reappearance at a public event, had helped her to walk into the abbey.
It was an historic setting for an historic occasion, with prayers for a "long life lived fully".
With the abbey bells ringing, a choir singing and crowds in the streets outside, this was something of the bigger funeral that Covid prevented last year.
The Queen and Prince Philip had been married for 73 years and in her Christmas message the Queen spoke in unusually personal terms about the loss of her "beloved" Philip.
The flowers on display at the memorial service included orchids, a reference to the orchids in the Queen's wedding bouquet. She and Prince Philip were married in 1947 at Westminster Abbey.
Representatives of some of the 700 charitable organisations that he supported were present, ranging from the Outward Bound Trust and Voluntary Services Overseas to the Caravan and Motorhome Club.
Many of his charities had a focus on inspiring young people and giving them wider opportunities. There was also an emphasis on conservation and protecting the environment.
Prince Philip's love of the sea and his links with the Armed Forces were heard during the service in the music of the Royal Marines band, which concluded with a piece called The Seafarers.
The Queen, Duchess of Cornwall and Princess Royal all wore dark green for the service - a similar shade to Edinburgh Green, the duke's livery colour.