Go onto this website and check whether your exit is in the list.
If it's not there (which it won't if you never came in contact with a CBP official on exit), then once you're back home from your travels, send:
a printout of the result page of this search (not the same as the first link);
a photocopy of your passport ID page;
photocopies of all passport stamps obtained since leaving the US (and in particular the Mexican entry stamp)
all original tickets that you still have from the US to Mexico, through Central America to Costa Rica (after making copies for your own record);
the original boarding pass and bag tag from Costa Rica back home if you still have them (after making a copy for your own record)
A dated bank statement showing all transactions since leaving the US.
Any dated original receipts obtained since leaving the US.
A letter explaining in detail your entire trip, stating the date and place of exit from the US, and asking for the exit to be added to the electronic I94
Send all these materials by registered mail to:
Coleman Data Solutions
Box 7965
Akron, OH 44306
Attn: NIDPS (I-94)
USA
If the evidence is deemed to be sufficient, the record (first link) will be updated, so check it from time to time. Note that Coleman don't respond to any communication.
If, for any reason, the record is not corrected (check regularly), then gather all the above mentioned evidence (except the passport copy and explanation letter) and bring them on your next trip to the US for presentation at the border, so that the record can be retroactively corrected. However, this should only be done as a last resort, because if you're unlucky enough to get the wrong officer on re-entry, you may well be refused entry and marked in the immigration records in spite of any evidence you present, and as you don't hold a visa, you have no right to appeal to an immigration judge