Narrative:

As I departed I called ral tower to transition their airspace and they notified me that I had traffic at 12 o'clock at the same altitude. I climbed and started a turn to the left looking for the traffic. I found the traffic and notified ral tower; as they approved my transition but notified me to call socal as I had climbed into ontario's airspace to avoid the traffic.even though I had broke into the airspace; it should not be an issue as it was done to avoid an accident. After I had the traffic in sight I lost attitude to get out of the airspace as soon as possible. I did contact socal when I left ral's airspace as directed by ral.

Google
 

Original NASA ASRS Text

Title: When the pilot of a homebuilt departing RIR took evasive action to avoid traffic he inadvertently entered controlled airspace.

Narrative: As I departed I called RAL Tower to transition their airspace and they notified me that I had traffic at 12 o'clock at the same altitude. I climbed and started a turn to the left looking for the traffic. I found the traffic and notified RAL tower; as they approved my transition but notified me to call SOCAL as I had climbed into Ontario's airspace to avoid the traffic.Even though I had broke into the airspace; it should not be an issue as it was done to avoid an accident. After I had the traffic in sight I lost attitude to get out of the airspace ASAP. I did contact SoCal when I left RAL's airspace as directed by RAL.

Data retrieved from NASA's ASRS site as of July 2013 and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.