WASHINGTON — Oil and gas companies will have to capture toxic and climate-altering gases from wells, storage sites and pipelines under new air quality standards issued on Wednesday by the Environmental Protection Agency.

The rule is the first federal effort to address serious air pollution associated with the natural gas drilling process known as hydraulic fracturing, or fracking, which releases toxic and cancer-causing chemicals like benzene and hexane, as well as methane, a powerful greenhouse gas.

The standards were proposed last summer in response to complaints from citizens and environmental groups that gases escaping from the 13,000 wells drilled each year by fracking were causing health problems and widespread air pollution.

Industry groups said meeting the proposed standards would cost hundreds of millions of dollars and slow the boom in domestic natural gas production. The original proposal was significantly revised, giving industry more than two years to comply and lowering the cost.