opinion of the Court:
¶ 1 Under Arizona law, a court may award reasonable attorney fees to the successful party in a contested contract action. A.R.S. *566§ 12-341.01(A). If a party makes a written settlement offer that is rejected and the final judgment is more favorable to the offering party, that party “is deemed to be the successful party from the date of the offer.” Id.
¶ 2 In this case, we address the interplay between this statutory provision and a contractual fee award provision when one party rejected the other’s written settlement offer and later obtained a less favorable judgment. Because the contract does not itself define “prevailing party,” but does incorporate Arizona law to determine the parties’ rights and remedies, we hold that the statute applies for the purpose of determining the successful party. That is, the party that made the rejected offer is the successful party from the date of the offer,
I.
¶3 In 2003, American Power Products (“American”) and CSK Auto (“CSK”) entered into a Master Vendor Agreement (“MVA”) under which American agreed to sell electric scooters and other items to CSK on an open account. The MVA provided that in the event of any action arising out of the agreement, “the prevailing party shall be entitled to recover ... reasonable attorneys’ fees.” The agreement did not define “prevailing party.” But the MVA included a broad choice-of-law provision that Arizona law would govern the parties’ “rights and remedies” under the agreement.
¶ 4 In 2005, American sued CSK for breach of contract and negligent misrepresentation, seeking more than $5 million in damages. CSK asserted various affirmative defenses and counterclaims and sought damages of approximately $950,000. In 2011, several months before trial, CSK served American with an offer of judgment under Rule 68, Ariz. R. Civ. P., in the amount of $1,000,001, “inclusive of all damages, taxable court costs, interest and attorneys’ fees.” American did not accept the offer and, after trial, obtained a jury verdict in the amount of $10,733. The trial court later dismissed CSK’s counterclaims with prejudice.
¶ 5 On the parties’ post-trial claims for attorney fees, the trial court ruled that American was the “prevailing party” at trial despite American having asked the jury to award it over $10.8 million. Applying a totality- of-the-litigation test, the court reasoned that American “must be the prevailing party” because “after litigating all of the claims” and counterclaims, American “obtained relief in the form of monetary damages; [CSK] was awarded nothing.” The trial court then awarded American $775,000 in attorney fees (Ameidcan had requested almost $2 million), plus costs and interest on the verdict, for a total judgment of approximately $861,000. The court denied CSK’s request for sanctions under Rule 68(g), Ariz. R. Civ. P., finding such sanctions inapplicable.
¶ 6 The court of appeals affirmed the fee award in favor of American. Am. Power Products, Inc. v. CSK Auto, Inc., 1 CA-CV 12-0855, at *8 ¶ 14, 2016 WL 2930686 (Ariz. App. May 19, 2016) (mem. decision).1 The court reasoned that the trial court did not abuse its substantial discretion in identifying the “prevailing party” and “had a reasonable basis for finding that American was the prevailing party under the totality of the litigation test.” Id. at *4 ¶ 6, *6 ¶ 9. Based on American having obtained a judgment less favorable than CSK’s pretrial settlement offer, CSK argued that AR.S. § 12-341.01(A) and Rule 68 precluded any award of fees American incurred after the date of the offer. In rejecting that argument, the court of appeals stated that “[w]hen attorneys’ fees are based on a contract—as here—the contract controls to the exclusion of A.R.S. § 12-341.01(A).” Id. at *6 ¶ 11. The court, however, “reverse[d] the superior court’s denial of CSK’s Rule 68 sanction request and remand[ed] to the superior court for it to make the comparison required by Rule 68.” Id. at *13 ¶ 30.
¶ 7 We granted review on the attorney fee question because the interplay between § 12-341.01 and contractual fee provisions presents legal issues of statewide importance *567that are likely to recur. We have jurisdiction under article 6, section 5(3) of the Arizona Constitution and A.R.S. § 12-120.24.
II.
¶ 8 The parties’ MVA contained two provisions that are pertinent here:
(d) Applicable Law. The MVA is made with reference to and under the laws of the State of Arizona which shall be deemed to govern the validity and interpretation of the MVA and the rights and remedies of the parties hereunder. Any legal action instituted by the parties arising out of this MVA shall be within, and the parties hereto stipulate to the jurisdiction of, the Courts of Maricopa County, Arizona.
[[Image here]]
(f) Attorneys’ Fees. In the event either party shall commence or be required to defend any action or proceeding against the other party arising out of this MVA, the prevailing party shall be entitled to recover from the other party its reasonable attorneys’ fees and costs through all levels of proceedings as determined by the court. As noted above, the MVA did not define “prevailing party.”
¶ 9 In pertinent part, A.R.S. § 12-341.01 provides:
A. In any contested action arising out of a contract, express or implied, the court may award the successful party reasonable attorney fees. If a written settlement offer is rejected and the judgment finally obtained is equal to or more favorable to the offeror than an offer made in writing to settle any contested action arising out of a contract, the offeror is deemed to be the successful party from the date of the offer and the court may award the successful party reasonable attorney fees. This section shall not be construed as altering, prohibiting or restricting present or future contracts or statutes that may provide for attorney fees.
As originally enacted in 1976, § 12-341.01 contained provisions now mirrored in the first and third sentences of subsection (A). The second sentence of that subsection was added in 1999.
¶ 10 CSK acknowledges that the trial court and court of appeals correctly “equated ‘prevailing party’ in the MVA with ‘successful party' in § 12-341.01(A).” Am. Power Products, Inc., 1 CA-CV 12-0855, at *3 ¶¶ 5-6; see Murphy Farrell Dev., LLLP v. Sourant, 229 Ariz. 124, 132 ¶ 30 & n.8, 134 ¶ 36, 272 P.3d 355, 364 & n.8, 365 (App. 2012) (relying on cases decided under § 12-341.01 in determining which party was “the ‘prevailing party' under the terms of the [parties’] Agreements” when those contracts mandated an award of fees to the “prevailing party” but did not define that term). Noting that “the parties expressly incorporated Arizona law into their contract” and “clearly intended to apply Arizona law to the entire [MVA],” however, CSK argues that both courts below erred in failing to apply “the definition in the second sentence of § 12-341.01(A).” Under that provision, CSK asserts, it is “the successful party after the date of its rejected settlement offer.”
¶ 11 American counters, as the court of appeals determined, that the trial court had a reasonable basis for deeming American the prevailing party under the MVA and did not abuse its discretion in awarding fees to American, particularly considering that CSK received nothing on its counterclaim for almost $1 million. Relying on the third sentence of § 12-341.01(A) and Arizona case law, American argues that the statute does not apply when, as here, a contract mandates an award of fees to the prevailing party. American further asserts that CSK’s argument, by seeking a sanction not recognized by Rule 68, effectively would amend the rule so as to conflict with § 12-341.01.
¶ 12 We review de novo issues of statutory application and contract interpretation. See Bell v. Indus. Comm’n, 236 Ariz. 478, 480 ¶ 6, 341 P.3d 1149, 1151 (2015) (statutes); Andrews v. Blake, 205 Ariz. 236, 240 ¶ 12, 69 P.3d 7, 11 (2003) (contracts). A trial court’s determination of which party is successful and thus entitled to a fee award generally will be upheld absent an abuse of discretion. Murphy Farrell Dev., 229 Ariz. at 133 ¶ 31, 272 P.3d at 364; Sanborn v. Brooker & Wake Prop. Mgmt., Inc., 178 Ariz. 425, 430, 874 P.2d 982, 987 (App. 1994). An error *568of law in reaching a discretionary ruling constitutes an abuse of discretion, Twin City Fire Ins. Co. v. Burke, 204 Ariz. 251, 254, 63 P.3d 282, 285 (2003).
III.
¶ 13 As noted above, § 12-341.01 does not “alter[], prohibit[] or restrict[]” contracts that “provide for attorney fees,” nor may the statute “be construed” to do so. § 12-341.01(A). Based on that statutory language, our court of appeals has repeatedly stated that “the statute is inapplicable ... [when] the parties have provided in their contract the conditions under which attorney’s fees may be recovered.” Sweis v. Chatwin, 120 Ariz. 249, 252, 585 P.2d 269, 272 (App. 1978); see also Geller v. Lesk, 230 Ariz. 624, 627 ¶ 9, 285 P.3d 972, 975 (App. 2012) (stating that parties’ contractual attorney fee provision, “not the statute,” governs an award of fees); Lisa v. Strom, 183 Ariz. 415, 418 n.2, 904 P.2d 1239, 1242 n.2 (App. 1995) (stating that “when a contract has an attorney’s fee provision it controls to the exclusion of the statute”); Connor v. Cal-Az Properties, Inc., 137 Ariz. 53, 55, 668 P.2d 896, 898 (App. 1983) (stating that “§ 12-341.01 is not to be considered” when parties’ contract provides conditions under which attorney fees may be recovered). In Sweis, the parties’ contract entitled the successful or prevailing party to a non-discretionary attorney fee award for enforcing the contract. 120 Ariz. at 251 n.2, 585 P.2d at 271 n.2. To apply § 12-341.01 in those circumstances, the court reasoned, would alter the agreement by “in effect canceling] the unqualified contractual right to recover attorney’s fees given to the successful party by their agreement, and substitute in its place the purely discretionary or permissive right given by the statute.” Id. at 252, 585 P.2d at 272.
¶ 14 Relying on its prior case law and the third sentence of § 12-341.01(A), the court of appeals here rejected CSK’s argument that, based on that subsection’s second sentence, CSK was the prevailing party from the date of its offer, holding instead that “the contract controls to the exclusion of A.R.S. § 12-341.01 (A).” Am. Power Products, Inc., 1 CA-CV 12-0855, at *6 ¶ 11. To the extent prior ease law broadly precludes application of § 12-341.01 whenever the parties’ contract contains an attorney fee provision, regardless of its content, scope, and other provisions in the contract, we disagree. Rather, § 12-341.01 “is inapplicable by its terms if it effectively conflicts with an express contractual provision governing recovery of attorney’s fees.” Jordan v. Burgbacher, 180 Ariz. 221, 229, 883 P.2d 458, 466 (App. 1994) (disagreeing with Connofs broad statement and observing that Sweis “did not hold that any express contractual provision for attorney’s fees, however worded, ‘preempts’ A.R.S. section 12-341.01”); cf. Tucson Estates Prop. Owners Ass’n, Inc. v. McGovern, 239 Ariz. 52, 54-56 ¶¶ 7-14, 366 P.3d 111, 113-15 (App. 2016); (stating that when parties’ contract has a unilateral provision mandating attorney fee recovery for only one party, § 12-341.01 applies to the other, successful party’s claim for attorney fees and affords trial court discretion to award or deny fees under the statute); Pioneer Roofing Co. v. Mardian Constr. Co., 152 Ariz. 455, 470-72, 733 P.2d 652, 667-69 (App. 1986) (same). Thus, rather than being completely supplanted by any attorney fee provision in the parties’ contract, the statute—consistent with its plain language—applies to “any contested action arising out of contract” to the extent it does not conflict with the contract. § 12-341.01(A).
¶ 15 Our conclusion comports with the general rule in Arizona that contracts are read to incorporate applicable statutes. See Banner Health v. Med. Sav. Ins. Co., 216 Ariz. 146, 150 ¶ 15, 163 P.3d 1096, 1100 (App. 2007) (“It has long been the rule in Arizona that a valid statute is automatically part of any contract affected by it, even if the statute is not specifically mentioned in the contract.”) (internal citations and quotation marks omitted); see also Yeazell v. Copins, 98 Ariz. 109, 113-14, 402 P.2d 541, 544 (1965). Because the MVA here did not define “prevailing party” and expressly provided that Arizona law shall apply and govern “the rights and remedies of the parties,” and because the second sentence of § 12-341.01(A) does not directly conflict with the MVA’s attorney fee provision, that statutory provision is “incorporated by operation of law” *569into the MVA for the limited purpose of defining “successful party” under the circumstances presented here. Banner Health, 216 Ariz. at 150 ¶ 15, 163 P.3d at 1100.
¶ 16 Contrary to the dissent, infra ¶28, our opinion does not “change the meaning of ‘the prevailing party’ in the MVA,” inasmuch as the MVA does not define that phrase or provide any other interpretative guidance. The dissent also downplays the MVA’s broad, unqualified choice-of-law provision, under which the parties agreed that Arizona law would govern their rights and remedies under the MVA. As for there being two prevailing parties—American before CSK’s offer, and CSK after its offer—that paradigm is implicitly contemplated and permitted by § 12-341.01(A)’s second sentence, which supplements, but does not alter, the MVA. Cf. Hall v. Read Dev., Inc., 229 Ariz. 277, 283 ¶ 19, 274 P.3d 1211, 1217 (App. 2012) (recognizing that statute’s second sentence could “potentially shift the ‘successful party' designation for at least part of the litigation”). And such a result is permissible even though § 12-341.01(A), like the MVA, limits attorney fee awards to “the” successful party.
¶ 17 American unpersuasively argues that the MVA’s choice-of-law provision does not apply to the attorney fee provision because they are separate and the former is “general and all-embracing, and not specific to the fees provision.” The choice-of-law provision is not limited, and the attorney fee provision does not exclude the former from applying to it. See Bradley v. Bradley, 164 P.3d 537, 542 (Wyo. 2007) (holding that broad, general language of choice-of-law provision in parties’ agreement applied to other provisions when the agreement contained no specific provision indicating a different intent and “[o]ther provisions of the agreement [did] not specifically speak to choice of applicable law”).
¶ 18 The courts below thus erred in failing to apply the definition of “successful party” under § 12-341.01(A)’s second sentence, which by its terms applies here given American’s rejection of CSK’s pretrial settlement offer under Rule 68 and the less favorable judgment American obtained after trial. As the court of appeals has observed, that statutory provision, “added in 1999, seemingly narrows the tidal court’s discretion in handling fee determination issues in contract cases, obligating the court to compare a written settlement offer against the ‘judgment finally obtained.’ ” Hall, 229 Ariz. at 279 ¶ 9, 274 P.3d at 1213. That comparison, in turn, “potentially alter[s] the successful party designation from the date of the offer.” Id. at 280 ¶ 10, 274 P.3d at 1214.
¶ 19 “[A]n offeror is the successful party, even if an offeree obtains a favorable judgment, if the offeror previously made a written offer for an amount equal to or greater than the final judgment.” Id. at 279 ¶ 9, 274 P.3d at 1213. That is precisely the situation here. CSK’s pretrial offer under Rule 68 in the amount of $1,000,001, “inclusive of all damages, taxable court costs, interest and attorneys’ fees,” was greater than the total judgment of approximately $861,000 (which included fees, costs, and interest on the $10,733 verdict) that American obtained. Thus, CSK “is deemed to be the successful party from the date of the offer.” § 12-341.01(A). And from that point forward CSK is “entitled to recover from [American] its reasonable attorneys’ fees” because the MVA expressly so provides. That is, the statute’s discretionary feature, providing that “the court may award the successful party reasonable attorney fees,” id. is inapplicable here because, if applied, it would directly conflict with the MVA’s mandatory fee provision and thereby impermissibly “alter[ ]” or “restrict[]” the parties’ agreement. Id.; see Murphy Farrell Dev., 229 Ariz. at 133 ¶ 32, 272 P.3d at 364 (“Unlike discretionary fee awards made pursuant to A.R.S. § 12-341.01(A), the trial court lacks discretion to deny a fee award required by the terms of the parties’ contract.”); McDowell Mountain Ranch Cmty. Ass’n v. Simons, 216 Ariz. 266, 269 ¶ 14, 165 P.3d 667, 670 (App. 2007) (same, citing eases).
¶ 20 Deeming CSK to be the prevailing party from the date of its settlement offer also furthers the policy of § 12-341.01 and Rule 68. As the court in Hall pointed out, “[t]he purposes of § 12-341.01(A) include: (1) mitigating ‘the burden of the ex*570pense of litigation to establish a just claim or a just defense’; (2) encouraging ‘more careful analysis prior to filing suit’ by imposing the risk of paying the opposing party’s attorneys’ fees where legitimate settlement offers are rejected; and (3) promoting settlement and thus reducing caseloads involving contractual matters.” Hall, 229 Ariz. at 282 ¶ 18, 274 P.3d at 1216. By rejecting CSK’s settlement offer and choosing to instead pursue costly, protracted litigation, American cannot avoid the legal consequences, including attorney fee exposure as determined by the parties’ agreement and compatible Arizona law that is specifically made applicable under the agreement’s choice-of-law provision.
¶ 21 American unpersuasively asserts that imposing attorney fees against it by “incorpo-rat[ing] only part of’ § 12-341.01(A) fails to give “the type of fair warning the law should provide.” On the contrary, the parties had adequate notice of their potential liability for attorney fees, given the MVA’s broad incorporation of Arizona law, the clear definition of “successful party” in § 12-341.01(A)’s second sentence, and the lack of any inconsistency between that provision and the MVA’s attorney fee provision.
¶22 Nor is American correct in arguing that CSK’s position will “alter every contract mandating an award of attorneys’ fees by forcing upon parties to contracts the standard established in the second sentence of A.R.S. § 12-341.01.A” Rather, we agree with American’s assertion that parties should “have freedom to contract whether they want that standard to apply or not.” As long as a contract is legal and enforceable, parties of course may fashion all aspects of an attorney fee provision, including a definition of “prevailing party” different from the statute, in whatever way they see fit. (Unlike the MVA, for example, a contract could not only specifically define “prevailing party” but also either include or exclude certain aspects of Arizona law from applying.)
¶23 Finally, we reject American’s argument that the result here “conflicts with and supersedes Rule 68.” As American conceded at oral argument in this Court, the sanctions prescribed in Rule 68(g) are separate and distinct from attorney fees. Cf. Ariz. R. Civ. P. 68, State Bar Committee Note (1992 Amendments) (“The term ‘costs’ in Rule 68 does not include attorneys’ fees, even if they are recoverable in the action.”) (citing Boltz & Odegaard v. Hohn, 148 Ariz. 361, 714 P.2d 854 (App. 1985)). Contrary to American’s contention, an award of fees to CSK under the MVA, based on the statutory definition of “successful party” in § 12-341.01(A)’s second sentence, does not result in “de facto amendment of the rule ... by imposing an additional sanction” not authorized by the rule. Nor does such an award run afoul of Rule 68(d)’s provision that “[ejvidence of an unaccepted offer is not admissible except in a proceeding to determine sanctions under this rule.” Harmonizing the rule with the statute, we conclude that any such evidence is inadmissible at trial or other merits-related proceedings, but is not barred for purposes of identifying the “successful party” under § 12-341.01(A) in separate post-trial proceedings regarding attorney fees. See Hall, 229 Ariz. at 283 ¶¶ 19-20, 274 P.3d at 1217 (harmonizing § 12-341.01(A) with Rule 68 to “conclude that comparing the ‘judgment finally obtained’ under § 12-341.01(A) to a settlement offer should involve only those reasonable fees and costs incurred as of the date the offer was made”); see also State v. Hansen, 215 Ariz. 287, 289 ¶ 7, 160 P.3d 166, 168 (2007) (stating that, whenever possible, we harmonize rules and statutes and read them in conjunction with each other).
IV.
¶ 24 For the reasons stated above, we reverse the trial court’s award of attorney fees to American and its ruling that American was the prevailing party in the proceedings below even after CSK’s settlement offer under Rule 68. We vacate paragraphs 6-16 of the court of appeals’ decision and remand the case to the trial court for further proceedings to apportion fees and costs between CSK and American consistent with this opinion. On remand, CSK must establish, and the trial court should determine, what amount or percentage of CSK’s fees (incurred after its settlement offer) was clearly attributable to defending against American’s claims as opposed to the unsuccessful prosecution of *571CSK’s counterclaim, on which CSK was not the prevailing party. Based on that determination, the trial court may then decide if, or by how much, CSK’s fee award should be reduced. In the end, as CSK acknowledged at oral argument, the trial court in its discretion may consider all pertinent factors in determining the amount of reasonable fees CSK should be awarded. Cf. Associated Indem. Corp. v. Warner, 143 Ariz. 567, 570-71, 694 P.2d 1181, 1184-85 (1985) (listing nonexclusive factors bearing on attorney fee awards under § 12-341.01); A.R.S. § 12-341.01(B) (providing that an award of reasonable fees under the statute “should be made to mitigate the burden of the expense of litigation to establish a just claim or a just defense”).
¶ 25 Regarding American’s attorney fees incurred before CSK’s offer of judgment, this opinion does not alter the trial court’s determination that American was the prevailing party up to that point. But American is not entitled to recover any fees incurred after CSK’s offer. (CSK conceded at oral argument that American is entitled to recover its reasonable attorney fees incurred before the offer.) Therefore, on remand American must establish, and the trial court should determine, what amount or percentage of the court’s $775,000 fee award to American was attributable to fees incurred after the offer, and the court should reduce American’s fee award by that amount. American’s request for attorney fees incurred in this Court is denied as it is not the prevailing party.
. The court of appeals' decision was rendered after we remanded the case to that court "for consideration of ... the parties' claims for attorneys’ fees, court costs, and other expenses." American Power Products, Inc., v. CSK Auto, Inc., 239 Ariz. 151, 157 ¶ 21, 367 P.3d 55, 61 (2016).