
27 Cal.3d 489 (1980)
612 P.2d 915
165 Cal. Rptr. 825
HUGH PETER BECKER et al., Plaintiffs and Appellants,
v.
S.P.V. CONSTRUCTION COMPANY, INC., et al., Defendants and Respondents.
Docket No. S.F. 24125.
Supreme Court of California.
July 3, 1980.
*491 COUNSEL
Edward S. Miller for Plaintiffs and Appellants.
Gerald R. Knecht and Louise R. Ogden for Defendants and Respondents.
OPINION
BIRD, C.J.
This court must decide whether a default judgment for $26,457.50 in damages, and $2,500 attorney's fees, is void under Code *492 of Civil Procedure section 580 if the underlying complaint sought damages "in excess of $20,000 ... or according to proof," punitive damages of $100,000, and costs.

I
Plaintiffs, Hugh Peter Becker and Ute I. Becker, appeal from an order vacating a default judgment against defendants S.P.V. Construction Company, Inc. (S.P.V.) and its president, George S. Soles. The case arose out of a contract for the construction of a residence for the Beckers by S.P.V. The Beckers asserted causes of action for breach of contract, fraud, and negligent misrepresentation.
On June 29, 1976, the summons and complaint were personally served on George Soles, individually and as president of S.P.V. Despite plaintiffs' numerous attempts to secure a responsive pleading, the defendants failed to respond to the complaint. On January 14, 1977, plaintiffs mailed copies to defendants and their attorney of a request to the court to enter default. The court entered the default five days later.
On February 7, 1977, plaintiffs agreed to set aside the default and gave the defendants 15 additional days in which to respond to the complaint. Again, the defendants failed to respond. Accordingly, the defaults of both defendants were entered for the second time on August 10, 1977. Following a hearing and review of documentary evidence, judgment by default was rendered against defendants on November 7, 1977, for $26,457.50 compensatory damages, $2,500 attorney's fees, and costs.
Over eight months later, on July 11, 1978, defendants moved to vacate the judgment on the ground that it exceeded the court's jurisdiction under Code of Civil Procedure section 580.[1] That motion was granted without opinion on August 9, 1978. This appeal followed.

II
To determine the propriety of the defendants' motion to vacate the default judgment, this court must look to the rules which govern collateral attacks on judgments since the defendants' motion was not timely *493 under section 473. (Wells Fargo & Co. v. City etc. of S.F. (1944) 25 Cal.2d 37, 40 [152 P.2d 625].) (1) "Collateral attack is proper to contest [a judgment void on its face for] lack of personal or subject matter jurisdiction or the granting of relief which the court has no power to grant [citations omitted]." (Armstrong v. Armstrong (1976) 15 Cal.3d 942, 950 [126 Cal. Rptr. 805, 544 P.2d 941]; see generally 5 Witkin, Cal. Procedure (2d ed. 1971) Attack on Judgment in Trial Court, § 10, pp. 3590, 3591.) In Burtnett v. King (1949) 33 Cal.2d 805 [205 P.2d 657, 12 A.L.R.2d 333], this court held that a court has no power to enter a default judgment other than in conformity with section 580. (Accord Swycaffer v. Swycaffer (1955) 44 Cal.2d 689, 692-693 [285 P.2d 1]; see also Armstrong v. Armstrong, supra, 15 Cal.3d at p. 950; Barquis v. Merchants Collection Assn. (1972) 7 Cal.3d 94, 120, fn. 25 [101 Cal. Rptr. 745, 496 P.2d 817].) Therefore, consideration of the merit of defendants' challenge to the judgment as violative of that statute is appropriate.
(2) Section 580 provides in relevant part that "[t]he relief granted to the plaintiff, if there be no answer, cannot exceed that which he shall have demanded in his complaint...." The primary purpose of this section is to insure that defendants in cases which involve a default judgment have adequate notice of the judgments that may be taken against them. (Anderson v. Mart (1956) 47 Cal.2d 274, 282 [303 P.2d 539].) "If a judgment other than that which is demanded is taken against him, [the defendant] has been deprived of his day in court  a right to a hearing on the matter adjudicated." (Burtnett v. King, supra, 33 Cal.2d at p. 808; accord Swycaffer v. Swycaffer, supra, 44 Cal.2d at p. 693.)
(3a) Defendants contend that the judgment violated section 580 because it awarded compensatory damages in excess of $20,000  the largest amount specifically requested in the complaint. Plaintiffs, on the other hand, contend that the prayer for compensatory damages "in excess of $20,000" was sufficient under section 580 to provide adequate notice of defendants' potential liability for $26,457.50. In effect, they argue that section 580 requires notice of the type of relief sought, but does not restrict the award of damages to the specific amount stated in the complaint.
However, the language of section 580 does not distinguish between the type and the amount of relief sought. The plain meaning of the prohibition against relief "exceed[ing]" that demanded in the complaint *494 encompasses both of these considerations. (§ 580; see Note, Default Judgments in Excess of Prayer (1952) 4 Stan.L.Rev. 278.) Moreover, three other statutory provisions support the view that defaulting defendants should not be subject to damages in excess of an amount specifically set out in the complaint. Section 425.10 requires that the amount of damages be pleaded in causes of action other than for personal injury or wrongful death. In contract actions, section 585, subdivision 1, authorizes entry of judgment on default only "for the principal amount demanded in the complaint...." In actions other than at contract, section 585, subdivision 2, provides that a default judgment may be awarded only "for such sum (not exceeding the amount stated in the complaint), as appears by such evidence to be just." (Italics added; see also § 425.11.)
The notice requirement of section 580 was designed to insure fundamental fairness. Surely, this would be undermined if the door were opened to speculation, no matter how reasonable it might appear in a particular case, that a prayer for damages according to proof provided adequate notice of a defaulting defendant's potential liability. If no specific amount of damages is demanded, the prayer cannot insure adequate notice of the demands made upon the defendant. (See Ludka v. Memory Magnetics International (1972) 25 Cal. App.3d 316, 323 [101 Cal. Rptr. 615].) Consequently, a prayer for damages according to proof passes muster under section 580 only if a specific amount of damages is alleged in the body of the complaint. (Thorson v. Western Development Corp. (1967) 251 Cal. App.2d 206 [59 Cal. Rptr. 299].)[2]
Here, the specific amount of damages alleged in the complaint was $20,000. Accordingly, the trial court exceeded its jurisdiction under section 580 insofar as it awarded damages in excess of that amount. It is irrelevant that the award of damages was within the total amount of compensatory and punitive damages demanded in the complaint. (4) Since compensatory and punitive damages are different remedies in both nature and purpose, a "demand or prayer for one is not a demand *495 legally, or otherwise, for the other, or for both." (Gudarov v. Hadjieff (1952) 38 Cal.2d 412, 417 [240 P.2d 621].)
(3b) There is one additional error in the judgment entered below. Plaintiffs failed to set forth in their complaint a prayer for attorney's fees. Under section 580, the trial court exceeded its authority when it granted such relief.
(5) The defendants contend that these errors render the entire judgment void. However, they fail to distinguish those cases in which a judgment has been modified to excise a portion violative of section 580. (E.g., Gudarov v. Hadjieff, supra, 38 Cal.2d 412; Brooks v. Forington (1897) 117 Cal. 219 [48 P. 1073]; Parrott v. Den (1867) 34 Cal. 79.) Since the challenged judgment only partially exceeded the court's jurisdiction, the trial court could have modified the judgment to save that portion which was not void. (See Wilkinson v. Wilkinson (1970) 12 Cal. App.3d 1164, 1168 [91 Cal. Rptr. 372].) Defendants cite no policy or authority for the proposition that this power cannot be exercised if a judgment in excess of jurisdiction is challenged collaterally rather than directly. Were the court's default judgment to remain vacated, any new judgment entered pursuant to the default would be subject at the trial level to a direct attack under section 473. Fairness to the plaintiffs and judicial economy require that such repetitious litigation be avoided.
Therefore, the trial court's order vacating the entire judgment is reversed. The case is remanded to the trial court with directions to modify the judgment by striking the award of damages in excess of $20,000 and any attorney's fees. The parties are to bear their own costs on appeal.
Tobriner, J., Mosk, J., Clark, J., Richardson, J., Manuel, J., and Newman, J., concurred.
Appellants' petition for a rehearing was denied July 30, 1980.
NOTES
[1]  Unless otherwise indicated, all statutory references are to the Code of Civil Procedure.
[2]  Richee v. Gillette Realty Co. (1929) 97 Cal. App. 365 [275 P. 477] is consistent with this holding. That case involved an action upon two promissory notes in which the defendant promised that in the event it were necessary for the plaintiff to file suit defendant would pay such attorney's fees as the court found to be reasonable. On appeal, the defendant challenged a default judgment awarding attorney's fees, arguing that this award was barred by the plaintiff's failure to allege a specific amount due. The court upheld the award. Since the defendant had agreed to abide by the discretion of the court in this matter, the court held it could not be heard to complain that the complaint lacked specificity. (Id., at p. 366-367; see also § 585, subd. 1.)
