The longtime pair, who split up last year, showed no hard feelings as they embraced just before stepping onto the green carpet before a large crowd in London's glittering Leicester Square.
"I really like it. We're friends. It's good to see him," said Diaz, 34, who wore a long black Chanel dress.
"It's great having him around. We've not been able to sit down and have a chat yet we've been so busy," said Diaz, who voices Fiona, the princess.
Timberlake, 26, who voices the future King Arthur, said of the premiere: "It's massive, it doesn't get any bigger than this I don't think."
Asked about his love life, Timberlake joked: "I'm allergic to those type of questions."
Other actors attending included Mike Myers, who plays the lovable green ogre Shrek, Antonio Banderas and Rupert Everett.
"Shrek the Third" opens nationwide in Britain on June 29.