Blinken's visit is part of the Biden administration's first U.S.-Mexico High-Level Security Dialogue, where the delegations sought to sketch out how to tackle everything from drug flows to the United States to the smuggling of U.S.-made guns into Mexico.
In a joint statement about the new accord, dubbed the Bicentennial Framework, the two nations pledged to work on the causes of violence and drug addiction, as well as monitor port smuggling of precursor chemicals for fentanyl and other drugs fuelling a record number of overdose deaths on U.S. soil.
"After 13 years of the Merida Initiative, it's time for a comprehensive new approach to our security cooperation, one that will see us as equal partners in defining our shared priorities," Blinken said.
Earlier, Lopez Obrador took Blinken on a tour of the murals at the National Palace before a working breakfast.
The Mexican leader said in a tweet afterward that there were "excellent conditions to inaugurate a new stage of the bilateral relationship." He also invited U.S. President Joe Biden to visit.
U.S. Secretary of Homeland Security Alejandro Mayorkas and U.S. Attorney General Merrick Garland accompanied Blinken, who also met with Foreign Minister Marcelo Ebrard.
U.S.-Mexico relations suffered a major blow last October when U.S. anti-narcotics agents arrested Mexican former defense minister Salvador Cienfuegos, outraging the Mexican government. Cienfuegos was freed amid intense Mexican pressure, but the detention strained relations and hurt security cooperation.
U.S. officials are touting the new security accord as broader than the Merida Initiative, which initially provided military equipment for Mexico and later helped train Mexico's security forces, police and the judiciary.
Lopez Obrador has been a vocal critic of the program, saying it was tainted by its association with previous governments and its failure to prevent bloodshed and escalating violence in the so-called war on drugs.
But negotiating a new agreement will be painful. Washington espouses a more muscular approach to battling drug gangs inside Mexico while Lopez Obrador prefers softer and less confrontational methods to fighting gangs, say analysts.
"There is a complete clash of paradigms," said Falko Ernst, a Mexico-based senior analyst at the Crisis Group. "But they are stuck on the same carriage on a very long and winding road."
The positive is that both sides are talking and eager to pragmatically reset a thorny relationship, Ernst added.
Blinken said the United States wants the bilateral relationship to be about more than security and border issues, though migration remains a key element in the balance of ties.
A surge in the number of Haitian and other Latin American migrants arriving at the U.S.-Mexico border plunged the Biden administration into another crisis last month and underlined Washington's reliance on Mexico to help stem the flow.
Blinken said the United States was in daily contact with Mexican officials over U.S.-bound Haitian migrants.
Mexico's importance in managing immigration has given the Lopez Obrador administration leverage to pursue more independent policies in other areas, Mexican officials say privately.
Mexico has made it tougher for American law enforcement agents to operate in the country and even delayed visas for U.S. anti-narcotics officers, the U.S. media has reported.
A senior Mexican security official said there was optimism about the new agreement on the Mexican side and there may be scope to review the restrictions imposed on U.S. agents operating on Mexican soil, but the conditions cannot return to how they were before Cienfuegos' arrest.
"I think part of the U.S. government knows that that's not possible," the Mexican official said.
(Reporting by Simon Lewis in Mexico City Additional reporting by Humeyra Pamuk in Washington and Cassandra Garrison and Daina Beth Solomon in Mexico City Writing by Drazen Jorgic Editing by Alistair Bell and Matthew Lewis) ((firstname.lastname@example.org; Reuters Messaging: email@example.com))