TORONTO - Gold miner Agnico Eagle Mines Ltd. has signed an agreement to buy O3 Mining Inc. in a friendly deal valued at about $204 million.