Hamilton was a close friend of Lauda as the three-time F1 world champion played a key role in his Mercedes team.
The five-time world champ Brit previously paid tribute to Lauda saying he was a “bright light”.
Hollywood stars Arnold Schwarzenegger and Daniel Bruehl, who played Lauda in the film Rush, also attended.
Members of Lauda’s family accompanied pallbearers carrying his remains into the gothic cathedral early in the morning.
His wife Birgit and two of his sons placed Lauda’s red-and-white driver’s helmet on his coffin.
Alongside the current F1 championship leader Hamilton was a parade of other motorsport legends.
World champions Alain Prost and Nigel Mansell arrived together, both of whom had raced against Lauda in the 80s.
And F1 legend Jackie Stewart, who worked with Lauda on improving safety in the sport, also was pictured.
Hamilton’s former teammate and 2016 world champ Nico Rosberg also arrived to pay his respects.
“He was Niki, he is our national hero, our icon”
Lauda was beloved in the F1 paddock and had one of the most tremendous stories in all sport.
Winning his first world championship in 1975 with Ferrari, he then suffered a horrifying crash in 1976.
He was left trapped inside the firey wreck of his car at the Nurburgring – having to pulled free by other drivers.
Doctors feared for his life, but within six-weeks the heavily burned Lauda was back behind the wheel.
The Austrian racer went on to win two world titles after his accident, in 1977 and 1984.
F1 bosses Ross Brawn, Jean Todt and Chase Carey also arrived amid the falling the rain at St Stephen’s Cathedral in Vienna.
And also in attendance was Mercedes chief and Lauda’s friend Toto Wolff, ex-F1 drivesr David Coulthard and Jacky Ickx, and ex-F1 team boss Flavio Briatore.
Others sportsmen coming to pay tribute to the national icon included former ski champions Hermann Maier and Franz Klammer, and skier Aksel Lund Svindal.
Austrian president Alexander van der Bellen also arrived at the funeral, along with the Mayor of Vienna Michael Ludwig.
And alongside the legend and stars, thousands of F1 fans braved heavy rain to pay their last respects to motor racing great.
Fans filed past the raised casket, which was flanked by candles and floral wreaths in the centre of the cathedral, many queuing outside for an hour or more.
“He was Niki, he is our national hero, our icon,” mourner Marion Hahn said. “I have never done anything like this, to stand in line for someone for this long but I hope he rests in peace. He deserves it.”
After several hours, the cathedral’s doors closed and onlookers gathered outside, standing several deep behind police barriers.
Roughly 500 guests attended a Requiem Mass, which was also open to members of the public but took place behind closed doors.
Lauda’s former McLaren teammate Prost was due to give a reading from the Old Testament at the private ceremony, the Vienna archdiocese said.
Terminator star Schwarzenegger is also said to be giving a speech at the end of the service.
Lauda was the only driver to have been a champion for both Ferrari and McLaren.
The 70-year-old passed away before the Monaco Grand Prix, where his close pal Hamilton went on to win.
Lauda gas been a key part of the Mercedes team which have dominated the sport since 2014.
He is reportedly set to be buried in his famous Ferrari race suit, driving for the team from 1974 to 1977, with full state honours.
His burial will take place in the Neustifter Friedhof in the Doebling borough, where his mother is buried.
Lauda’s coffin will be carried out of the cathedral by racing drivers before being driven to his final resting place.