
822 So.2d 593 (2002)
Gustavo RAMIREZ, Appellant,
v.
STATE of Florida, Appellee.
No. 2D02-1859.
District Court of Appeal of Florida, Second District.
August 9, 2002.
STRINGER, Judge.
Gustavo Ramirez appeals the order summarily denying his timely motion for post-conviction relief filed pursuant to Florida Rule of Criminal Procedure 3.850. The trial court denied Ramirez's second post-conviction relief motion as successive. We disagree and reverse the trial court's order denying Ramirez relief.
The prior motion filed by Ramirez, even though denominated a motion for postconviction relief, only raised sentencing errors. The second motion for postconviction relief filed by Ramirez argued that he received ineffective assistance from his trial counsel. The trial court reviewed the second motion and determined that Ramirez had failed to allege a reason for his piecemeal filing of the postconviction relief claim, and pursuant to Foster v. State, 614 So.2d 455 (Fla.1992), the court denied the motion as successive.
However, in Foster the supreme court explained:
A successive motion may be dismissed if it fails to allege new or different grounds for relief and the prior determination was on the merits or, if new and different grounds are alleged, the failure to raise those issues in a prior motion constitutes an abuse of process. Fla. R.Crim. P. 3.850. To overcome this bar, a movant must allege that the grounds asserted were not known and could not have been known to him at the time of the earlier motion. Christopher v. State, 489 So.2d 22, 24 (Fla.1986). The movant must show justification for the failure to raise the issues in the prior motions. Id.

Foster, 614 So.2d at 458.
Therefore, based on the language in Foster, the trial court properly should *594 have dismissed Ramirez's motion, rather than denying it. Further, pursuant to Kelly v. State, 712 So.2d 780 (Fla. 2d DCA 1998), the second motion was not a successive postconviction motion since Ramirez's original motion only raised claims that his sentence was illegal. In Kelly, this court held that where a defendant's first collateral motion merely attacked the legality of his sentence, the court (for purposes of determining whether a second postconviction motion is successive) should have considered that motion based on its substance, not its title. Under the circumstances of this case, Ramirez's first motion should be treated as a motion to correct illegal sentence, not a postconviction motion.
Accordingly, we reverse the trial court's order and remand for further proceedings in accordance with this opinion.
Reversed and remanded for further proceedings.
ALTENBERND and SALCINES, JJ., Concur.
