The agreement, signed on Tuesday, marks NASA's first formal commitment to launch international crew members to the lunar vicinity as part of NASA's Artemis missions.
"This partnership leverages the outstanding cooperation established by the International Space Station as we push forward to the Moon," NASA Administrator Jim Bridenstine said in a statement.
"Gateway will continue to expand NASA's cooperation with international partners like ESA, ensuring the Artemis program results in the safe and sustainable exploration of the Moon after the initial human lunar landing and beyond."
NASA said that additional Gateway agreements with other international partners will be executed in the near future.
Under this agreement, ESA will contribute habitation and refueling modules, along with enhanced lunar communications, to the Gateway.
The refueling module also will include crew observation windows. In addition to providing the hardware, ESA will be responsible for operations of the Gateway elements it provides.
ESA is also providing two additional European Service Modules (ESMs) for NASA's Orion spacecraft. These ESMs will propel and power Orion in space on future Artemis missions and provide air and water for its crew.
Approximately one-sixth the size of the International Space Station, the Gateway will function as a way station located tens of thousands of miles from the lunar surface, in a Near Rectilinear Halo Orbit, from which NASA and its international and commercial partners will be able to springboard robotic and human expeditions to and around the Moon and on to Mars.
It will serve as a rendezvous point for astronauts traveling to lunar orbit aboard NASA's Space Launch System (SLS) and Orion prior to transit to low-lunar orbit and the surface of the Moon.
NASA is preparing to send the first woman and next man to the lunar surface in 2024.
The US space agency is aiming to return humans to Moon in preparation of its next giant leap -- human exploration of Mars as early as the 2030s.