Invoke Webservice/Apex Class using Custom Button

Best Suitable case: Invoking WebService using Custom button from Record detail page

1 . Create a global Apex Class as shown,

global class wsAccountUpdate {    
    webService static void updateAccount(Id accId) { 
        Account a = [SELECT Id, Name, OwnerID 
                     FROM Account
                     WHERE Id =: accId];
        // above is sample query you can replace with your own             
        .....
        .....logic goes here
        .....                
        update a;            
    }
}

2 . Create a Custom button

A glance of Custom Button creation,

here how we invoke Apex Class,

{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")} 

sforce.apex.execute("wsAccountUpdate","updateAccount", 
{accId: "{!Account.Id}"}); 

window.top.location.reload();

Passing Parameters, right now we're passing only one parameter, if you want to do pass more parameters those should be coma seperated as shown,

syntax:

sforce.apex.execute(<<class__Name>>,<<Method__Name>>,
{param1: "value1"
,* param2: "value2", param3: "value3"});

NOTE: Most importantly dont forget to add custom button in Page Layout