BERLIN — German lawmakers approved legislation on Friday that grants publishers the right to charge search engines and other online aggregators for reproducing their content but continues to allow the free use of text in links and brief summaries.

As originally proposed by the government of Chancellor Angela Merkel last year, the law was seen as a clear attempt by a European government to force big Internet companies like Google to share some of the billions of euros they earn from the sale of advertising placed alongside the news that Google links to.

But a last-minute change, proposed last week by the Free Democratic Party, the junior partner in Ms. Merkel’s government, allowed for the use of “individual words or the smallest excerpts of text” free, meaning that only those companies who reproduce full texts for commercial use will be required to compensate the news publishers.

The weakened bill passed Germany’s lower house, the Bundestag, 293 to 243. But it will require approval by Germany’s upper house, the Bundesrat, which is controlled by the Social Democrats and the Greens, in the opposition, which have sought to have the bill scrapped altogether.