Hamilton overcame difficulties in practice to clinch second on the grid in a red flag-laden qualifying session on Saturday, yet he finished 15th in Sunday's race.
Max Verstappen, Hamilton's championship rival, crashed with five laps remaining, and a red flag resulted in a standing start.
Yet the seven-time world champion, with his brakes smoking, careered off the track moments after the restart, enabling Perez to cruise to victory.
"Today was a humbling experience," Hamilton tweeted, having initially apologised to the team from his car.
"We worked so hard to put ourselves back in the top 10 today after a rocky week here in Baku. We gave it our all today and a small error caused the brakes to switch off.
"Sorry to the team, we'll come back stronger for the next race."
Today was a humbling experience. We worked so hard to put ourselves back in the top 10 today after a rocky week here in Baku. We gave it our all today and a small error caused the brakes to switch off. Sorry to the team, we’ll come back stronger for the next race 🙏🏾 pic.twitter.com/oHy75S07L3— Lewis Hamilton (@LewisHamilton) June 6, 2021
Mercedes' official team account echoed Hamilton's sentiment.
"This is hard to take. We worked so hard this weekend to put ourselves into the fight after a really difficult start on Friday – only to leave with nothing," the team's tweet read.
"[We] need a big reaction next time out in France."
Sunday's drama means Red Bull hold a 26-point lead in the constructors' championship, with Verstappen (105) four points ahead of Hamilton in the drivers' standings.