The counterclaim from Facebook, filed in a San Francisco federal court, comes after Yahoo sued Facebook for patent infringement last month. A Yahoo spokesman could not immediately be reached for comment.
Facebook, the world's largest Internet social networking service, is preparing for an initial public offering that could value the company at up to $100 billion.
According to Facebook's counterclaim, Yahoo services such as the photostream and the recent activity feature in Yahoo's Flickr photo-sharing service infringe a Facebook patent related to generating a personalized feed of stories on a social network.
Facebook general counsel Ted Ullyot said the company had indicated that it would defend itself vigorously in the face of Yahoo's lawsuit.
"While we are asserting patent claims of our own, we do so in response to Yahoo's short-sighted decision to attack one of its partners and prioritize litigation over innovation," Ullyot said in a statement.
Yahoo has claimed Facebook infringed 10 of Yahoo's patents, including several that cover online advertising technology.