Worldwide recognition (2002–2009)
In Julie Taymor's biographical film Frida (2002), Hayek served as a producer and starred as surrealist painter Frida Kahlo. She became interested in the role several years prior to commencing production for the film, having "been fascinated by Kahlo's work from the time she was 13 or 14", although not immediately a fan: "At that age I did not like her work [...] I found it ugly and grotesque. But something intrigued me, and the more I learned, the more I started to appreciate her work. There was a lot of passion and depth. Some people see only pain, but I also see irony and humor. I think what draws me to her is what [husband] Diego saw in her. She was a fighter. Many things could have diminished her spirit, like the accident or Diego's infidelities. But she wasn't crushed by anything". She was so determined to play the role that she sought out Dolores Olmedo Patino, longtime-lover of Diego Rivera, and, after his death, administrator to the rights of Frida and Rivera's art, which Rivera had "willed [...] to the Mexican people", bequeathing the trust to Olmedo. Hayek personally secured access to Kahlo's paintings from Kahlo and began to assemble a supporting cast, approaching Alfred Molina for the role of Rivera in 1998. Upon its release, Frida was a critical darling and an arthouse success. In his review for the film, David Denby of The New Yorker concluded: "Smart, willful, and perverse, this Frida is nobody's servant, and the tiny Hayek plays her with head held high". Her portrayal of Kahlo made her the first Mexican actress to be nominated for the Academy Award for Best Actress and earned her Golden Globe Award, Screen Actors Guild Award and British Academy Film Award nominations for Best Actress.
In 2003, Hayek produced and directed The Maldonado Miracle, a Showtime film based on the book of the same name, for which she won the Daytime Emmy Award for Outstanding Directing in a Children Special, reunited with Robert Rodriguez for Spy Kids 3-D: Game Over and Once Upon a Time in Mexico, and made an appearance in the documentary V-Day: Until the Violence Stops. Once Upon a Time in Mexico, which made $98.2 million worldwide, was the final film of the Mariachi Trilogy and featured Hayek reprising her role from Desperado.
In Brett Ratner's action comedy After the Sunset (2004), Hayek starred as the girlfriend of a master thief, with Pierce Brosnan. A box office flop, the film received largely negative reviews from critics. James Berardinelli found the film to be "a mess, but [it's] a fun, breezy mess", criticizing the overall heist and weak characterization but gave praise to the quick pacing chemistry between Brosnan and Hayek. In 2005, she served as a member of the 58th Cannes Film Festival jury, co-hosted the annual Nobel Peace Prize Concert with Julianne Moore in Oslo, Norway, and directed a music video for Prince, titled "Te Amo Corazon" ("I love you, sweetheart") that featured Mía Maestro.
Hayek appeared alongside her good friend Penélope Cruz in the 2006 Western comedy Bandidas, portraying two women who become a bank robbing duo in an effort to combat a ruthless enforcer terrorizing their town. Randy Cordova of the Arizona Republic said the film "sports" Hayek and her co-star Penélope Cruz as the "lusty dream team" and that they were the "marketing fantasy" for the film. Bandidas was followed by Ask the Dust, a period romance set in Los Angeles based on a John Fante novel and co-starring Colin Farrell. Peter Bradshaw of The Guardian found "something a little forced in both lead performances", and with a limited theatrical release, the film was not a financial success. Her last film of 2006 was Lonely Hearts, a neo-noir crime drama chronicling the notorious "lonely hearts killers" of the 1940s, Raymond Fernandez and Martha Beck, in which Hayek played Beck, with Jared Leto taking on the role of Fernandez. The film received mixed reviews from critics, but the cast garnered praise. Peter Travers of Rolling Stone stated: "When Hayek and Leto are onscreen, you do not look away."
Hayek served as an executive producer for the American television series Ugly Betty (2006–2010), after adapting the story for American television with Ben Silverman, who acquired the rights and scripts from the Colombian telenovela Yo Soy Betty La Fea in 2001. Originally intended as a half-hour sitcom for NBC in 2004, the project would later be picked up by ABC for the 2006–2007 season with Silvio Horta also producing. She guest-starred on the series as Sofia Reyes, a magazine editor. Ugly Betty was a success with critics and audiences, won a Golden Globe Award for Best Comedy Series in 2007, and earned Hayek nominations for both Outstanding Guest Actress in a Comedy Series and Outstanding Comedy Series at the 59th Primetime Emmy Awards. After finalizing negotiations with MGM to become the CEO of her own Latin-themed film production company, Ventanarosa, in 2007, Hayek signed a two-year deal with ABC for Ventanarosa to develop projects for the network.
In 2007, Hayek made a cameo appearance, as a nurse singing a cover of The Beatles song "Happiness Is A Warm Gun", in Julie Taymor's jukebox musical romantic drama Across the Universe. The role of Madame Truska, a woman who can grow an indestructible beard, in Cirque du Freak: The Vampire's Assistant (2009), was Hayek's first acting project following the birth of her daughter. She characterized the film, which was an adaptation of the book series The Saga of Darren Shan by author Darren Shan, as "a little bit of hard work. But it's not like I have to be emotionally devastated for months". The film was a critical and commercial failure. Screen Rant felt that Hayek is "fun as the bearded lady Madame Truska but [...] is unable to single-handedly elevate the material".