Opinion
KANE, J.In this personal injury case, defendant Desert Christian Center was successful in proving its affirmative defense that the injuries alleged by plaintiff Frank D. Brown were within the exclusive jurisdiction of the workers’ compensation system. A judgment of dismissal was entered and defendant sought to recover its costs as the prevailing party under Code of *736Civil Procedure section 1032.1 Plaintiff moved to strike defendant’s memorandum of costs, asserting that since defendant prevailed on the ground of lack of subject matter jurisdiction, the trial court lacked jurisdiction to award costs. The trial court granted plaintiff’s motion and defendant now appeals from that order. Defendant contends on appeal that the trial court had jurisdiction to award costs under the particular circumstances of this case. We agree and accordingly reverse the trial court’s order striking the memorandum of costs.
FACTS AND PROCEDURAL HISTORY
On December 14, 2006, plaintiff was injured at defendant’s building site in Ridgecrest, California, when he fell from a ladder while painting and doing paint preparation work. On November 14, 2008, plaintiff filed a complaint in Kern County Superior Court against defendant, seeking the recovery of damages for his personal injuries. The complaint included causes of action for premises liability and general negligence, and alleged as supporting facts that while plaintiff was working for defendant as an unlicensed contractor2 he sustained serious personal injuries as a result of defendant’s negligent failure to provide a safe work environment.
Defendant filed an answer consisting of a general denial and several affirmative defenses. The affirmative defenses included a ninth affirmative defense, which asserted that plaintiff’s exclusive remedy for his injuries was workers’ compensation benefits.
On October 14, 2009, plaintiff filed a first amended complaint. The first amended complaint specified that the injury occurred when plaintiff fell from a ladder and suffered a severe fracture of the right femur. The amended pleading also alleged that plaintiff was not covered by defendant’s workers’ compensation insurance policy and/or that he was informed that such coverage would not apply to him.3 Defendant’s answer to the first amended complaint once again asserted as a ninth affirmative defense that plaintiff’s *737exclusive remedy was to seek benefits available to him under the workers’ compensation system.
The case came on regularly for trial on November 23, 2009. Before proceeding to other issues in the case, the trial court convened an evidentiary hearing or minitrial to determine the merits of defendant’s ninth affirmative defense and to exercise “its inherent power to inquire into its subject matter jurisdiction.”4 After hearing evidence that included a number of exhibits and the testimony of several witnesses, the trial court found that defendant’s ninth affirmative defense was meritorious. Specifically, the trial court held that plaintiff’s injuries were sustained within the course and scope of his employment with defendant, no exemption to workers’ compensation coverage applied, and plaintiff was covered by defendant’s workers’ compensation policy. Therefore, workers’ compensation was plaintiff’s exclusive remedy, the matter came within the exclusive jurisdiction of the workers’ compensation system, and the trial court lacked subject matter jurisdiction. In the trial court’s written order filed on December 31, 2009, the action was dismissed based on lack of subject matter jurisdiction. A judgment of dismissal was thereafter entered.
Defendant filed a memorandum of costs by which it sought the recovery of allowable costs pursuant to section 1032 as the prevailing party in the case. The total amount of costs claimed in the memorandum was $7,909.88, the majority of which consisted of deposition costs.
Plaintiff responded by filing a motion to strike the entire memorandum of costs on the ground that no costs could be awarded by the trial court because it did not have subject matter jurisdiction. The trial court agreed that it lacked jurisdiction to award costs and granted the motion to strike the memorandum of costs. Defendant timely appealed from that order.
DISCUSSION
The question of whether or not the trial court had jurisdiction to award costs under the circumstances presented is essentially one of law; thus, we conduct an independent review. (Shisler v. Sanfer Sports Cars, Inc. (2008) 167 Cal.App.4th 1, 6 [83 Cal.Rptr.3d 771] (Shisler); Salawy v. Ocean Towers Housing Corp. (2004) 121 Cal.App.4th 664, 669 [17 Cal.Rptr.3d 427].)
I. Defendant Met Statutory Criteria for Entitlement to Cost Award
The right to recover costs is entirely a creature of statute (Murillo v. Fleetwood Enterprises, Inc. (1998) 17 Cal.4th 985, 989 [73 Cal.Rptr.2d 682, *738953 P.2d 858]), and section 1032 is “the fundamental authority for awarding costs in civil actions” (Scott Co. v. Blount, Inc. (1999) 20 Cal.4th 1103, 1108 [86 Cal.Rptr.2d 614, 979 P.2d 974]). Section 1032 establishes the following rule: “Except as otherwise expressly provided by statute, a prevailing party is entitled as a matter of right to recover costs in any action or proceeding.” (Id., subd. (b).) As defined by the statute, a “ ‘[prevailing party’ ” includes “a defendant in whose favor a dismissal is entered.” (Id., subd. (a)(4).) Therefore, upon dismissal of an action in a defendant’s favor, that party is entitled to an award of costs under the clear authority and mandate of these statutory provisions. “ ‘No qualifications or conditions are imposed. He [or she] is entitled to . . . costs as a matter of right. . . .’ ” (Sealand Inv. Corp. v. Shirley (1961) 190 Cal.App.2d 323, 324 [12 Cal.Rptr. 164].)
In the present case, defendant was the prevailing party because a judgment of dismissal was entered in its favor. (§ 1032, subd. (a)(4).) Since no other statute expressly provided to the contrary,5 defendant was plainly entitled to recover its costs as a matter of right. (Id., subd. (b).)
Furthermore, we note the statutory language is clear and explicit that “a defendant in whose favor a dismissal is entered” is a “prevailing party” and “entitled as a matter of right to recover costs.” (§ 1032, subds. (a)(4) & (b).) Nothing in the wording of the statute indicates that a defendant’s right to recover costs is limited to certain types of dismissals (e.g., dismissals on nonjurisdictional grounds). Since the Legislature has not distinguished between types of dismissals in the statute, we will not read such a restriction into it. “ ‘[0]ne should not read into the statute allowing costs a restriction which has not been placed there. “In general, a court should not look beyond the plain meaning of a statute when its language is clear and unambiguous, and there is no uncertainty or doubt as to the legislative intent. [Citation.]” [Citation.]’ ” (Crib Retaining Walls, Inc. v. NBS/Lowry, Inc. (1996) 47 Cal.App.4th 886, 890 [54 Cal.Rptr.2d 850]; see also Agnew v. State Bd. of Equalization (2005) 134 Cal.App.4th 899, 913 [36 Cal.Rptr.3d 464] [“When the Legislature intends to restrict the recovery of costs or fees[,] it knows how to express such restriction.”].)
Therefore, assuming there was no fundamental jurisdictional defect that deprived the trial court of power to award costs, defendant was clearly entitled to such an award under a plain reading of section 1032. We now turn to the specific issue of the trial court’s jurisdiction to award costs in this case.
*739II. The Trial Court’s Jurisdiction to Award Costs
A. Jurisdiction to Determine Jurisdiction Supported Judgment of Dismissal and Costs Incidental Thereto
We begin with the procedural context in which the issue at hand was raised. Defendant properly raised the jurisdictional issue of workers’ compensation coverage by asserting it as an affirmative defense. Generally speaking, in a lawsuit for personal injury damages, a defendant has the burden of pleading and proving, as an affirmative defense, the existence of the conditions of compensation under the workers’ compensation law. (Doney v. Tambouratgis (1979) 23 Cal.3d 91, 96 [151 Cal.Rptr. 347, 587 P.2d 1160].) Based on the allegations of the first amended complaint and defendant’s answer, the disputed factual issues before thé trial court relating to this jurisdictional defense included whether plaintiff, as an unlicensed contractor, was an employee of defendant, and if so, whether defendant satisfied its obligation of securing workers’ compensation insurance coverage that applied to plaintiff.6 Depending on how the trial court resolved those issues, subject matter jurisdiction would either be exclusively in the workers’ compensation system or exclusively in the trial court. “Jurisdiction, once determined, is exclusive and is not concurrent.” (Rowland v. County of Sonoma (1990) 220 Cal.App.3d 331, 333 [269 Cal.Rptr. 426].)
After conducting an evidentiary hearing on defendant’s ninth affirmative defense, the trial court resolved the disputed factual issues and found that plaintiff’s injuries were wholly covered by workers’ compensation law. Plaintiff’s exclusive remedy was therefore under workers’ compensation law and the trial court was without subject matter jurisdiction to act with respect to that remedy. (La Jolla Beach & Tennis Club, Inc. v. Industrial Indemnity Co. (1994) 9 Cal.4th 27, 43 [36 Cal.Rptr.2d 100, 884 P.2d 1048] [workers’ compensation tribunal, rather than trial court, had exclusive jurisdiction over award of workers’ compensation benefits]; Rowland v. County of Sonoma, supra, 220 Cal.App.3d at p. 333 [if exclusive workers’ compensation remedy applies, the civil courts have no jurisdiction over the matter].) Having determined that subject matter jurisdiction was lacking, the trial court further concluded it had no jurisdiction to award costs. We hold that further conclusion was mistaken in this case, as we presently explain.
*740Preliminarily, we recognize and do not downplay the fundamental nature of subject matter jurisdiction. As summarized by our Supreme Court: “ ‘The principle of “subject matter jurisdiction” relates to the inherent authority of the court involved to deal with the case or matter before it.’ [Citation.] Thus, in the absence of subject matter jurisdiction, a trial court has no power ‘to hear or determine [the] case.’ [Citation.] And any judgment or order rendered by a court lacking subject matter jurisdiction is ‘void on its face . . . .’ [Citation.]” (Varian Medical Systems, Inc. v. Delfino (2005) 35 Cal.4th 180, 196 [25 Cal.Rptr.3d 298, 106 P.3d 958].)
In the case before us, however, the trial court was not lacking in power or authority to resolve the jurisdictional defense before it and to enter a judgment or order based thereon, because it clearly had jurisdiction to determine its own jurisdiction. (Walker v. Superior Court (1991) 53 Cal.3d 257, 267 [279 Cal.Rptr. 576, 807 P.2d 418] [a court has inherent authority to inquire into its own jurisdiction]; Scott v. Industrial Acc. Com. (1956) 46 Cal.2d 76, 83 [293 P.2d 18] [a court has concurrent jurisdiction, with the Industrial Accident Commission, to determine whether it has subject matter jurisdiction]; Abelleira v. District Court of Appeal (1941) 17 Cal.2d 280, 302 [109 P.2d 942] [a court has jurisdiction to determine its own jurisdiction].) “[A] tribunal has the duty, and therefore the authority or power (jurisdiction), to decide in the first instance whether it has jurisdiction of the subject matter and the parties, and whether it also has jurisdiction to act in a particular manner. This process may involve the determination of jurisdictional facts, or of jurisdictional questions of law.” (2 Witkin, Cal. Procedure (5th ed. 2008) Jurisdiction, § 339, p. 963; see Rowland v. County of Sonoma, supra, 220 Cal.App.3d at p. 334.) That was precisely what happened here, when the trial court determined in defendant’s favor the issues raised by the ninth affirmative defense. The judgment of dismissal and the matters that preceded it were, therefore, validly based on the trial court’s inherent power and authority to determine its own jurisdiction.
Since the trial court had jurisdiction to resolve the dispositive issue between the parties of workers’ compensation exclusivity and to enter a judgment of dismissal based thereon, in our opinion the trial court also had jurisdiction to award costs. That is because costs are normally viewed as an incident of a judgment. (See Wells Fargo & Co. v. City etc. of S. F. (1944) 25 Cal.2d 37, 44 [152 P.2d 625] [“The awarding of costs is but an incident to the judgment [citations], and is therefore within the court’s jurisdiction to enter the judgment.”]; Douglas v. Willis (1994) 27 Cal.App.4th 287, 290 [32 Cal.Rptr.2d 408] [costs are incident to the judgment]; People v. One 1937 Plymouth 6 (1940) 40 Cal.App.2d 38, 40 [104 P.2d 372] [costs “incidental” to *741the judgment]; Gutting v. Globe Indemnity Co. (1931) 119 Cal.App. 288, 289 [6 P.2d 298] (Gutting) [costs incidental to a judgment “upon the issues in the action”].) We see no reason that should not be the case here.7 The trial court had power to adjudicate defendant’s affirmative defense and to enter the ensuing judgment of dismissal based on its inherent jurisdiction to determine its own jurisdiction. In such circumstances, the award of costs incidental tó that judgment of dismissal would come within the same jurisdictional safety net.
Hence, the trial court’s finding that defendant prevailed on the merits of its jurisdictional defense did not operate as a double-edged sword that brought a complete victory in the lawsuit but, with the same stroke, extinguished the trial court’s power to award costs incurred in achieving that victory. Rather, at least in the context of this case where the issue of workers’ compensation exclusivity was raised as an affirmative defense under the pleadings, decided on the merits through resolution of disputed facts and became the basis for the dismissal, the trial court’s power to award costs survived as an incident of the resulting judgment of dismissal.8
In so holding, we note that the present case was not one in which, under the allegations of the complaint, the trial court never had a viable basis for subject matter jurisdiction. We do not offer an opinion of whether the outcome would be different in a case such as that. Here, it should be observed, the trial court initially had the usual subject matter jurisdiction that any superior court would have over a common law personal injury lawsuit where the plaintiff’s allegations do not facially disclose that his exclusive remedy was under workers’ compensation law. (See Doney v. Tambourat gis, supra, 23 Cal.3d at p. 98.) Once the issue of workers’ compensation exclusivity was specifically raised by the pleadings and had to be judicially decided, the trial court continued to have jurisdiction, at least in the sense we *742are describing of jurisdiction to determine its own jurisdiction, until it resolved the disputed jurisdictional facts in defendant’s favor and entered the dismissal. (Ibid.)9
B. Cases Relied on by Trial Court Distinguishable
In holding that it had no jurisdiction to award costs, the trial court relied on two cases: Begbie v. Begbie (1900) 128 Cal. 154 [60 P. 667] (Begbie) and Gutting, supra, 119 Cal.App. 288. To our knowledge, Gutting is the only published California case specifically holding that if a trial court determines there is no subject matter jurisdiction, it cannot award costs.10 We believe that both cases may be fairly distinguished.
Begbie, supra, 128 Cal. 154, was a marital dissolution case in which the sole issue was the marital status of the parties. The husband succeeded in obtaining a decree of divorce, and the wife appealed. While the appeal was pending, the wife died. The wife’s representatives wanted the appeal to be heard (not dismissed) for the limited purpose of obtaining an award of costs. The Supreme Court refused to do so for various reasons. First, since the action was solely for the purpose of determining personal status, it abated upon the wife’s death, and the court was therefore deprived of all authority to review the proceedings of the superior court. (Id. at p. 155.) Second, “[w]hen a suit abates by the death of a party there can be no judgment for costs in favor of the survivor,” and the rule is the same when the action is pending on appeal. (Ibid.) Third, under the cost statute in effect at that time, “[t]here can be no judgment for costs except as a part of the judgment upon the issues in the action . . . and, if the court loses power to render a judgment *743between the parties upon the issues before it, it is equally powerless to render a judgment for the costs incurred therein.” (Ibid.)
Begbie is distinguishable on its face. It did not involve a lack of subject matter jurisdiction, but the automatic abatement of an action to determine personal status due to the death of a party. As a result of that abatement, neither party could prevail or obtain a judgment on any of the issues in the case. In our case, however, the trial court actually determined a material issue between the parties that was raised in the pleadings—namely, defendant’s ninth affirmative defense—and the judgment of dismissal in defendant’s favor was based upon that determination. Therefore, the case before us is distinguishable from the abatement of proceedings that occurred in Begbie.
In Gutting, supra, 119 Cal.App. 288, the trial court issued a minute order dismissing an action for want of subject matter jurisdiction in response to a motion by the defendant. The defendant filed a cost bill which, in turn, prompted a motion to strike by the plaintiff. The trial court denied the motion and awarded costs to the defendant. The plaintiff appealed, and a divided Court of Appeal reversed the trial court. The majority stated: “We are of the opinion that the allowance of costs as authorized by said section 1024 is confined to cases of which the court has jurisdiction.” (Id. at p. 289.) The only California authority offered in support of that conclusion was the Begbie case, which was cited for the proposition that “if the court loses power to render a judgment between the parties upon the issues before it, it is equally powerless to render a judgment for the costs incurred therein.” (Gutting, supra, at p. 289.)
It is difficult to compare Gutting to the present case because the opinion provides almost no information. We do not know why the trial court lacked subject matter jurisdiction in that case or the context in which the issue was raised. No indication is given whether, as in the case here, there were facts pled by the plaintiff that, taken as true, would have potentially resulted in the court having subject matter jurisdiction. Likewise, we do not know whether, as in the present case, the issue of lack of subject matter jurisdiction was raised by the defendant as an affirmative defense, with the outcome depending on resolution of disputed factual issues. Also, to the extent Gutting relied on the language in Begbie that costs are premised on a judgment and unless the trial court has jurisdiction to enter a judgment on issues in the case, it cannot award costs, we distinguish it for the same reasons noted above with respect to Begbie. That is, the present case did involve the determination of issues in the case by the trial court—namely, the jurisdictional defense that was affirmatively pleaded and proved by the defendant, resulting in the judgment of dismissal.
*744But the main reason that we distinguish Gutting is that it does not address the question of whether, or under what conditions, a cost award may be based on or incidental to a judgment of dismissal that was entered under a trial court’s jurisdiction to determine jurisdiction. Since our case does involve that question, we find Gutting inapplicable. To the extent Gutting may be read to hold that costs may never be awarded in a case that the trial court determines there is a lack of subject matter jurisdiction, we disagree.
One authority the trial court declined to follow was Ablett v. Hancock Oil Co. (1935) 10 Cal.App.2d 58 [50 P.2d 1077] (Ablett). In Ablett, the trial court had awarded costs to the defendants who obtained a dismissal of the plaintiff’s complaint on the ground that the trial court was without jurisdiction based upon a failure by the plaintiff to exhaust other remedies. The Court of Appeal affirmed the trial court’s award of costs, noting a distinction should be applied where the trial court did not refuse to act for want of jurisdiction, but exercised jurisdiction and proceeded to determine the matter as an evidentiary issue. Since the dismissal was based on a failure to prove a certain fact (i.e., the exhaustion of remedies), the judgment was on issues that had arisen in the action and was analogous to a nonsuit. The Court of Appeal held that, in such a context, the award of costs was proper. (Id. at p. 60.) We believe Ablett is analogous to the present case. Here, in reaching the merits of defendant’s ninth affirmative defense, the trial court was not refusing to act for want of jurisdiction; it exercised inherent jurisdiction to inquire into its jurisdiction and, in so doing, determined based on the evidence an issue raised as a jurisdictional defense.
C. Conclusion
We do not purport to hold that in every dismissal based on lack of subject matter jurisdiction, costs may be awarded under section 1032, but only that such costs may be awarded in the particular circumstances before us. In this case, where the potential that the trial court lacked subject matter jurisdiction was one of the issues between the parties in the case, having been specifically raised in the pleadings as an affirmative defense, and defendant succeeded in proving that defense, the trial court had power to award costs following entry of the resulting judgment of dismissal. That judgment of dismissal and the proceedings on which it depended were based on the trial court’s jurisdiction to determine its own jurisdiction. Moreover, the trial court did not merely declare that it lacked jurisdiction or abate the action or refuse to act, it determined by resolution of disputed facts that the defendant prevailed on its jurisdictional defense. We believe that such a judgment of dismissal is sufficient to carry with it the power to award costs incidental thereto, and that such cost award would rest on the same jurisdictional foundation that supported the judgment of dismissal.
*745DISPOSITION
The trial court’s order striking the memorandum of costs is reversed. The case is remanded with instructions that the trial court award costs to defendant, as prevailing party, pursuant to section 1032.
Levy, Acting P. J., and Vortmann, J.,* concurred.
Unless otherwise indicated, all further statutory references are to the Code of Civil Procedure.
We note that Labor Code section 2750.5 creates a rebuttable presumption that a contractor is an employee rather than an independent contractor when doing work that requires a license. It was unclear from the original complaint whether the work performed by plaintiff required a license. A license is not generally required, for example, if the total project cost is less than $500. (Bus. & Prof. Code, § 7048.) The first amended complaint more clearly alleged that defendant was required to hire a licensed contractor for the work that plaintiff performed.
Labor Code section 3706 provides that an injured employee can bring an action at law for damages against the employer where the employer fails to secure workers’ compensation benefits (e.g., where the employer is uninsured).
The trial court stated the evidentiary hearing was held pursuant to Evidence Code sections 402 through 405.
No contrary statutory provisions have been brought to our attention, nor has our independent research revealed any conflicting cost statute.
The resolution of disputed facts would allow the trial court to determine whether workers’ compensation applied, or whether there was an exemption to such coverage based on statutory provisions such as Labor Code sections 2750.5 and 3706, and Business and Professions Code section 7048. (See fns. 2 & 3, ante.)
We view this judgment of dismissal as essentially the same as other judgments for purposes of section 1032, which is consistent with the fact that the statute expressly grants a right to costs to a defendant in whose favor dismissal is entered. (See § 581d [dismissals entered by court constitute judgments].)
In another procedural context, costs have been allowed despite the fact that subject matter jurisdiction is prospectively lacking in the case: Namely, where a dismissal with prejudice has divested the trial court of jurisdiction. (See, e.g., Hagan Engineering, Inc. v. Mills (2003) 115 Cal.App.4th 1004, 1007-1008 [9 Cal.Rptr.3d 723] [stating rule that after a voluntary dismissal with prejudice, trial court no longer has subject matter jurisdiction but still retains power to hear motion for costs]; Harris v. Billings (1993) 16 Cal.App.4th 1396, 1405 [20 Cal.Rptr.2d 718] [same].)
In Doney v. Tambouratgis, supra, 23 Cal.3d at pages 96-99, the Supreme Court, in refusing to allow the defendant to raise workers’ compensation coverage for the first time by a motion at the conclusion of the plaintiff’s case-in-chief, observed as follows regarding the trial court’s subject matter jurisdiction: “The trial court clearly had subject matter jurisdiction over such an action unless and until it was properly demonstrated that the case was one ‘covered by the statute’ due to the presence therein of the conditions of compensation set forth in section 3600 of the Labor Code. As indicated above, such a demonstration may occur in one of two ways—i.e., either by the plaintiff through alleging facts indicating coverage under the act in his pleadings, or by the defendant through setting up the affirmative defense of coverage in responsive pleadings and proceeding to prove the existence of the requisite conditions. When, as in this case, no such demonstration has been made in either fashion, the court properly proceeds to exercise its existing jurisdiction to enforce the common law remedy.” (Id. at pp. 98-99, italics added.)
But see Shisler, supra, 167 Cal.App.4th at page 4, where the Court of Appeal held that where the trial court lacked personal jurisdiction, it still had authority to award attorney fees. In so holding, the Court of Appeal acknowledged Gutting, and in dicta agreed with it, but distinguished the situation of lack of personal jurisdiction from lack of subject matter jurisdiction (Shisler, supra, at pp. 6-9).
Judge of the Tulare Superior Court, assigned by the Chief Justice pursuant to article VI, section 6 of the California Constitution.