No – the U.S. Supreme Court recently held that a defendant need not obtain a favorable ruling on the merits to recover attorneys’ fees under Title VII.
Title VII provides that district court has discretion to award a “prevailing party” reasonable attorneys’ fees and costs in litigation arising under the statute.  42 U.S.C. § 2000e-5(k).  In CRST Van Expedited, Inc. v. EEOC, the Supreme Court addressed the question of whether a “prevailing party” must obtain a favorable ruling on the merits to recover attorneys’ fees or whether a non-merits-based favorable ruling may suffice.  No. 14–1375 (May 19, 2016).
In CRST, a single employee filed a charge of discrimination against her employer alleging sexual harassment.  After investigating, the EEOC determined there was probable cause to support the charge.  The EEOC further found that there was probable cause to show that the employer subjected a class of current and prospective employees to sexual harassment.  The EEOC later filed a lawsuit against the employer on behalf of over 250 allegedly aggrieved female employees.  The district court, however, dismissed the lawsuit on the basis that the EEOC failed to adequately investigate or attempt to conciliate its claims.  Following the dismissal, the EEOC awarded the employer over $4 million in fees.  The Eighth Circuit Court of Appeals eventually reversed the fee award, holding that a Title VII defendant can only be a “prevailing party” by obtaining a “ruling on the merits.”
The U.S. Supreme Court disagreed with the Eighth Circuit’s requirement that a ruling on the merits was a prerequisite to an award of attorneys’ fees under Title VII.  The Court explained that:

The defendant, of course, might prefer a judgment vindicating its position regarding the substantive merits of the plaintiff ’s allegations.  The defendant has, however, fulfilled its primary objective whenever the plaintiff ’s challenge is rebuffed, irrespective of the precise reason for the court’s decision.  The defendant may prevail even if the court’s final judgment rejects the plaintiff ’s claim for a nonmerits reason.

The Court noted that one purpose of the fee-shifting provision was to deter litigation that was “frivolous, unreasonable, or groundless” and requiring a merits-based determination could undermine this objective.  For example, litigation might be frivolous if it was barred by non-merits-based determinations, such as state sovereign immunity or mootness.
Takeaway:  A defendant need not obtain a favorable ruling on the merits to recover attorneys’ fees as the prevailing party under Title VII.