At the beginning, you need have a list of store locations with Latitude/Longitude points. If your list doesn’t only contain Latitude/Longitude points, then you can use Google Maps API to get them.
Here is a php code sample:
//get Latitude/Longitud from google based on a address
$address = '11 Nicholson Street, Carlton VIC, Australia'; // Google HQ
$prepAddr = str_replace(' ','+',$address);
$lat = $output->results->geometry->location->lat;
$long = $output->results->geometry->location->lng;
echo $address.'<br>Lat: '.$lat.'<br>Long: '.$long;
The next thing is to calculate the distance from a given location to the store locations, and find the nearest locations. The distance calculation is based on the Haversine formula. You can use any program language to use that formula.
The recommend solution is using Google Maps API v3. Here is a tutorial from Google Geo APIs Team : Creating a Store Locator with PHP, MySQL & Google Maps
For more about Google Maps API, check here: The Google Geocoding API
Other Map API, have not been tested yet: Map Quest http://developer.mapquest.com/
For other requirement, like get a quickest route between two points, here is a php solution by using Google Maps API: How to Build a Distance Finder with Google Maps API